choices¶
choices
¶
Choice utility functions.
-
qirest_client.choices.
max_length
(choices)¶ Returns the size of the longest choice.
Param: the available choice strings or tuples Returns: the maximum length
-
qirest_client.choices.
roman_range_choices
(start, stop)¶ Returns the (arabic number, roman numeral) choice tuples for the given exclusive range bounds. This is useful, e.g., for displaying the tumor stage. (Yes, this is the 21st century).
Example:
>>> from qirest_client import choices >>> choices.roman_range_choices(1, 5) [('I', 1), ('II', 2), ('III', 3), ('IV', 4)]
Parameters: - start – the first value in the range
- stop – one greater than the last value in the range
- roman – flag indicating whether the display value is a roman numeral
Returns: the [(value, label)] choices list
Raises: ValueError – if the roman flag is set and start is less than one or stop is greater than five