IOLabel

class pyniryo_nate.models.io.IOLabel(*values)[source]

Bases: StrEnum

Labels of the inputs and outputs. Tool labels are prefixed with T, controller labels with C.

See Tool inputs and outputs and Controller inputs and outputs for the board signal each label maps to, and the robot user manual for the wiring of the connectors.

A robot may serve inputs and outputs whose labels are absent from this enumeration, added to the hardware after this client was installed. They are reported and addressed as raw strings, see parse().

Attributes

Methods

encode

Encode the string using the codec registered for encoding.

replace

Return a copy with all occurrences of substring old replaced by new.

split

Return a list of the substrings in the string, using sep as the separator string.

rsplit

Return a list of the substrings in the string, using sep as the separator string.

join

Concatenate any number of strings.

capitalize

Return a capitalized version of the string.

casefold

Return a version of the string suitable for caseless comparisons.

title

Return a version of the string where each word is titlecased.

center

Return a centered string of length width.

count

Return the number of non-overlapping occurrences of substring sub in string S[start:end].

expandtabs

Return a copy where all tab characters are expanded using spaces.

find

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].

partition

Partition the string into three parts using the given separator.

index

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].

ljust

Return a left-justified string of length width.

lower

Return a copy of the string converted to lowercase.

lstrip

Return a copy of the string with leading whitespace removed.

rfind

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].

rindex

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].

rjust

Return a right-justified string of length width.

rstrip

Return a copy of the string with trailing whitespace removed.

rpartition

Partition the string into three parts using the given separator.

splitlines

Return a list of the lines in the string, breaking at line boundaries.

strip

Return a copy of the string with leading and trailing whitespace removed.

swapcase

Convert uppercase characters to lowercase and lowercase characters to uppercase.

translate

Replace each character in the string using the given translation table.

upper

Return a copy of the string converted to uppercase.

startswith

Return True if S starts with the specified prefix, False otherwise.

endswith

Return True if S ends with the specified suffix, False otherwise.

removeprefix

Return a str with the given prefix string removed if present.

removesuffix

Return a str with the given suffix string removed if present.

isascii

Return True if all characters in the string are ASCII, False otherwise.

islower

Return True if the string is a lowercase string, False otherwise.

isupper

Return True if the string is an uppercase string, False otherwise.

istitle

Return True if the string is a title-cased string, False otherwise.

isspace

Return True if the string is a whitespace string, False otherwise.

isdecimal

Return True if the string is a decimal string, False otherwise.

isdigit

Return True if the string is a digit string, False otherwise.

isnumeric

Return True if the string is a numeric string, False otherwise.

isalpha

Return True if the string is an alphabetic string, False otherwise.

isalnum

Return True if the string is an alpha-numeric string, False otherwise.

isidentifier

Return True if the string is a valid Python identifier, False otherwise.

isprintable

Return True if all characters in the string are printable, False otherwise.

zfill

Pad a numeric string with zeros on the left, to fill a field of the given width.

format

Return a formatted version of S, using substitutions from args and kwargs.

format_map

Return a formatted version of S, using substitutions from mapping.

maketrans

Return a translation table usable for str.translate().

parse

Resolve a label to its member, or return it uppercased when it is not one of them.

TDI1 = 'TDI1'
TDI2 = 'TDI2'
TDO1 = 'TDO1'
TDO2 = 'TDO2'
TAI1 = 'TAI1'
TAI2 = 'TAI2'
CDI1 = 'CDI1'
CDI2 = 'CDI2'
CDI3 = 'CDI3'
CDI4 = 'CDI4'
CDI5 = 'CDI5'
CDI6 = 'CDI6'
CDI7 = 'CDI7'
CDI8 = 'CDI8'
CDO1 = 'CDO1'
CDO2 = 'CDO2'
CDO3 = 'CDO3'
CDO4 = 'CDO4'
CDO5 = 'CDO5'
CDO6 = 'CDO6'
CDO7 = 'CDO7'
CDO8 = 'CDO8'
CAI1 = 'CAI1'
CAI2 = 'CAI2'
CAO1 = 'CAO1'
CAO2 = 'CAO2'
classmethod parse(label: str) → IOLabel | str[source]

Resolve a label to its member, or return it uppercased when it is not one of them.

An unknown label is passed through rather than refused, so that a client keeps working against a robot that serves inputs and outputs it does not know. The robot is the authority on which labels exist, and refuses a write to a label it does not serve.

Parameters:

label (str) – The label to resolve, in any case.

Returns:

The matching member, or the uppercased label itself.

Return type:

IOLabel | str