IOLabel¶
- class pyniryo_nate.models.io.IOLabel(*values)[source]¶
Bases:
StrEnumLabels of the inputs and outputs. Tool labels are prefixed with
T, controller labels withC.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
encodeEncode the string using the codec registered for encoding.
replaceReturn a copy with all occurrences of substring old replaced by new.
splitReturn a list of the substrings in the string, using sep as the separator string.
rsplitReturn a list of the substrings in the string, using sep as the separator string.
joinConcatenate any number of strings.
capitalizeReturn a capitalized version of the string.
casefoldReturn a version of the string suitable for caseless comparisons.
titleReturn a version of the string where each word is titlecased.
centerReturn a centered string of length width.
countReturn the number of non-overlapping occurrences of substring sub in string S[start:end].
expandtabsReturn a copy where all tab characters are expanded using spaces.
findReturn the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
partitionPartition the string into three parts using the given separator.
indexReturn the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
ljustReturn a left-justified string of length width.
lowerReturn a copy of the string converted to lowercase.
lstripReturn a copy of the string with leading whitespace removed.
rfindReturn the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rindexReturn the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rjustReturn a right-justified string of length width.
rstripReturn a copy of the string with trailing whitespace removed.
rpartitionPartition the string into three parts using the given separator.
splitlinesReturn a list of the lines in the string, breaking at line boundaries.
stripReturn a copy of the string with leading and trailing whitespace removed.
swapcaseConvert uppercase characters to lowercase and lowercase characters to uppercase.
translateReplace each character in the string using the given translation table.
upperReturn a copy of the string converted to uppercase.
startswithReturn True if S starts with the specified prefix, False otherwise.
endswithReturn True if S ends with the specified suffix, False otherwise.
removeprefixReturn a str with the given prefix string removed if present.
removesuffixReturn a str with the given suffix string removed if present.
isasciiReturn True if all characters in the string are ASCII, False otherwise.
islowerReturn True if the string is a lowercase string, False otherwise.
isupperReturn True if the string is an uppercase string, False otherwise.
istitleReturn True if the string is a title-cased string, False otherwise.
isspaceReturn True if the string is a whitespace string, False otherwise.
isdecimalReturn True if the string is a decimal string, False otherwise.
isdigitReturn True if the string is a digit string, False otherwise.
isnumericReturn True if the string is a numeric string, False otherwise.
isalphaReturn True if the string is an alphabetic string, False otherwise.
isalnumReturn True if the string is an alpha-numeric string, False otherwise.
isidentifierReturn True if the string is a valid Python identifier, False otherwise.
isprintableReturn True if all characters in the string are printable, False otherwise.
zfillPad a numeric string with zeros on the left, to fill a field of the given width.
formatReturn a formatted version of S, using substitutions from args and kwargs.
format_mapReturn a formatted version of S, using substitutions from mapping.
maketransReturn a translation table usable for str.translate().
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