justbases._display module

Handling lists of digits.

class justbases._display.Decorators

Bases: object

Handle generic display stuff.

Returns decorators for the value.

classmethod decorators(config, relation)

Return prefixes for tuple.

Parameters:
  • config (DisplayConfig) – display configuration
  • relation (int) – relation of string value to actual value
static relation_to_symbol(relation)

Change a numeric relation to a string symbol.

Parameters:relation (int) – the relation
Returns:a symbol with the right relation to relation
Return type:str
class justbases._display.Digits

Bases: object

Transforms digits as ints to corresponding symbols.

classmethod xform(number, config, base)

Get a number as a string.

Parameters:
  • number (list of int) – a number
  • config (DigitsConfig) – configuration for displaying digits
  • base (int) – the base in which this number is being represented
Raises:

BasesValueError

class justbases._display.Number

Bases: object

Handle generic number display stuff.

Returns modifications to the number string.

classmethod xform(left, right, repeating, config, base, sign)

Return prefixes for tuple.

Parameters:
  • left (str) – left of the radix
  • right (str) – right of the radix
  • repeating (str) – repeating part
  • config (BaseConfig) – display configuration
  • base (int) – the base in which value is displayed
  • sign (int) – -1, 0, 1 as appropriate
Returns:

the number string

Return type:

str

class justbases._display.String

Bases: object

Convert size components to string according to configuration.

classmethod xform(radix, display, relation)

Transform a radix and some information to a str according to configurations.

Parameters:
  • radix (Radix) – the radix
  • display (DisplayConfig) – the display config
  • relation (int) – relation of display value to actual value
  • units – element of UNITS()
Returns:

a string representing the value

Return type:

str

class justbases._display.Strip

Bases: object

Handle stripping digits.

classmethod xform(number, config, relation)

Strip trailing zeros from a number according to config and relation.

Parameters:
  • number (list of int) – a number
  • config (StripConfig) – configuration for stripping zeros
  • relation (int) – the relation of the display value to the actual

Previous topic

justbases._constants module

Next topic

justbases._division module

This Page