justbases_string._string module
Obtaining a string from a list of digits.
-
class justbases_string._string.Digits(config, base)
Bases: object
Transforms digits as ints to corresponding symbols.
Initializer.
| Parameters: |
- config (DigitsConfig) – configuration for displaying digits
- base (int) – the base of the values to display
|
| Raises BaseDisplayValueError: |
| | if config options are bad
|
-
MAX_SIZE_BASE_FOR_CHARS = 36
-
xform(number)
Get a number as a string.
Does not use separator if using letters or if base is no more than 10.
| Parameters: | number (list of int) – a number |
| Returns: | the number as a string |
| Return type: | str |
-
class justbases_string._string.Number(config, base)
Bases: object
Handle generic number display stuff.
Returns modifications to the number string.
Initializer.
| Parameters: |
- config (BaseConfig) – display configuration
- base (int) – the base
|
-
xform(left, right, repeating, sign)
Return prefixes for tuple.
| Parameters: |
- left (str) – left of the radix
- right (str) – right of the radix
- repeating (str) – repeating part
- sign (int) – -1, 0, 1 as appropriate
|
| Returns: | the number string
|
| Return type: | str
|
-
class justbases_string._string.String(display, base)
Bases: object
Convert size components to string according to configuration.
Initializer.
| Parameters: |
- display (DisplayConfig) – the display config
- base (int) – the base of the radix
|
| Raises BaseDisplayValueError: |
| | if the configuration cannot work
|
-
xform(sign, integer_part, non_repeating_part, repeating_part, relation)
Transform information about a number to a string.
| Parameters: |
- sign (int) – the sign
- integer_part (list of int) – the integer part
- non_repeating_part (list of int) – the non-repeating part
- repeating_part (list of int) – the repeating part
- relation (Rational) – relation of display value to actual value
|
| Returns: | a string representing the value
|
| Return type: | str
|
| Raises BaseDisplayValueError: |
| |
|
-
class justbases_string._string.Strip(config, base)
Bases: object
Handle stripping digits.
Initializer.
| Parameters: |
- config (StripConfig) – configuration for stripping zeros
- base (int) – the base
|
-
xform(number, relation)
Strip trailing zeros from a number according to config and relation.
| Parameters: |
- number (list of int) – a number
- relation (int) – the relation of the display value to the actual
|