justbytes._config module

Configuration of the justbytes package.

class justbytes._config.DisplayConfig(strip=False, show_approx_str=True, strip_exact=True)

Bases: object

Superficial aspects of display.

class justbytes._config.InputConfig(unit=B, method=Round down.)

Bases: object

Configuration for input of Sizes.

Specifies rounding unit and method for Sizes constructed from user input.

class justbytes._config.SizeConfig

Bases: object

Configuration for Size class.

DISPLAY_CONFIG = StrConfig(show_approx_str=True, strip=False, strip_exact=True)
INPUT_CONFIG = InputConfig(method=Round down., unit=B)

Default configuration for interpreting input values.

STRICT = False
STR_CONFIG = StrConfig(base=10, binary_units=True, exact_value=False, max_places=2, min_value=1, rounding_method=Round to nearest, to zero on a tie., unit=None)

Default configuration for string display.

classmethod set_display_config(config)

Set configuration for superficial aspects of display.

Parameters:config (DisplayConfig) – a configuration object
classmethod set_input_config(config)

Set the configuration for input method for all Size objects.

:param InputConfig config: a configuration object

classmethod set_str_config(config)

Set the configuration for __str__ method for all Size objects.

:param StrConfig config: a configuration object

class justbytes._config.StrConfig(max_places=2, min_value=1, binary_units=True, exact_value=False, unit=None, base=10, rounding_method=Round to nearest, to zero on a tie.)

Bases: object

Configuration for __str__ method.

If max_places is set to None, all non-zero digits after the decimal point will be shown. Otherwise, max_places digits will be shown.

min_value sets the smallest value allowed. If min_value is 10, then single digits on the lhs of the decimal will be avoided if possible. In that case, 9216 KiB is preferred to 9 MiB. However, 1 B has no alternative. If min_value is 1, however, 9 MiB is preferred. If min_value is 0.1, then 0.75 GiB is preferred to 768 MiB, but 0.05 GiB is still displayed as 51.2 MiB.

Previous topic

justbytes._util.misc module

Next topic

justbytes._constants module

This Page