justbases._display module

Handling lists of digits.

class justbases._display.Decorators(config, base)

Bases: object

Handle generic display stuff.

Returns decorators for the value.

decorators(relation)

Return prefixes for tuple.

Parameters: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(config, base)

Bases: object

Transforms digits as ints to corresponding symbols.

xform(number, base)

Get a number as a string.

Parameters:
  • number (list of int) – a number
  • base (int) – the base in which this number is being represented
Raises BasesValueError:
 

if config is unsuitable for number

class justbases._display.Number(config, base)

Bases: object

Handle generic number display stuff.

Returns modifications to the number string.

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

Return prefixes for tuple.

Parameters:
  • left (str) – left of the radix
  • right (str) – right of the radix
  • repeating (str) – repeating part
  • 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(display, base)

Bases: object

Convert size components to string according to configuration.

xform(radix, relation)

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

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

a string representing the value

Return type:

str

Raises BasesValueError:
 

if configuration does not work with value

class justbases._display.Strip(config, base)

Bases: object

Handle stripping digits.

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

Previous topic

justbases._constants module

Next topic

justbases._division module

This Page