justbytes._util.display module

Handling lists of digits.

class justbytes._util.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 justbytes._util.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:

RangeValueError

class justbytes._util.display.Number

Bases: object

Handle generic number display stuff.

Returns modifications to the number string.

classmethod xform(left, right, config, base, positive)

Return prefixes for tuple.

Parameters:
  • left (str) – left of the radix
  • right (str) – right of the radix
  • config (DisplayConfig) – display configuration
  • base (int) – the base in which value is displayed
  • positive (bool) – whether value is non-negative
Returns:

the number string

Return type:

str

class justbytes._util.display.String

Bases: object

Convert size components to string according to configuration.

classmethod xform(radix, display, relation, units)

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 justbytes._util.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

justbytes._util package

Next topic

justbytes._util.generators module

This Page