justbases_string._config module
String method configuration.
-
class justbases_string._config.ApproxConfig(xform=<bound method ApproxPrefix.xform of <justbases_string._approx.ApproxPrefix object at 0x7f4531906310>>)
Bases: object
Whether and how to show approximation information.
Initializer.
| Parameters: | xform ((Rational * str) -> str) – a transformer for a number, to show approximation info |
-
class justbases_string._config.BaseConfig(use_prefix=False, use_subscript=True)
Bases: object
Whether and how to show the base.
Initializer.
| Parameters: |
- use_prefix (bool) – show base using prefix, e.g., 0x, 0
- use_subscript (bool) – show base using subscript
|
-
class justbases_string._config.DigitsConfig(separator='~', use_caps=False, use_letters=True)
Bases: object
How to display digits.
Initializer.
| Parameters: |
- separator (str) – separate for digits
- use_caps (bool) – if set, use capital letters
- use_letters (bool) – if set, use letters
|
If digits in this base require more than one character.
-
class justbases_string._config.DisplayConfig(approx_config=ApproxConfig(xform=<bound method ApproxPrefix.xform of <justbases_string._approx.ApproxPrefix object at 0x7f4531906310>>), base_config=BaseConfig(use_prefix=False, use_subscript=True), digits_config=DigitsConfig(separator=~, use_caps=False, use_letters=True), strip_config=StripConfig(strip=False, strip_exact=False, strip_whole=True))
Bases: object
Superficial aspects of display.
Initializer.
| Parameters: |
- approx_config (ApproxConfig) – how to show approximation information
- base_config (BaseConfig) – how to show base
- digits_config (DigitsConfig) – how to display digits
- strip_config (StripConfig) – how to strip zeros
|
There are only two base prefixes acknowledged, 0 for octal and 0x for
hexadecimal.
-
class justbases_string._config.StripConfig(strip=False, strip_exact=False, strip_whole=True)
Bases: object
Stripping trailing zeros.
Initializer.
| Parameters: |
- strip (bool) – strip all trailing zeros
- strip_exact (bool) – strip if value is exact
- strip_whole (bool) – strip if value is exact and non-fractional
|
strip is stronger than strip_exact which is stronger than strip_whole