zero.misc module

Miscellaneous functions

class zero.misc.ChangeFlagDict(*args, **kwargs)[source]

Bases: dict

Dict with flag which gets set when a change is made after initialisation.

class zero.misc.Downloadable(info_stream=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, progress=True, timeout=None, **kwargs)[source]

Bases: object

Mixin for downloadable URL classes, providing a progress bar.

fetch(*args, **kwargs)[source]
fetch_file(url, filename=None, params=None, label=None)[source]
class zero.misc.NamedInstance[source]

Bases: abc.ABCMeta

Metaclass to implement a single named instance pattern

This ensures that there is only ever one instance of a class with a specific name, as provided by the “name” constructor argument.

This is a subclass of ABCMeta so that it can be used as a metaclass of a subclass of an ABCMeta class.

class zero.misc.Singleton[source]

Bases: abc.ABCMeta

Metaclass implementing the singleton pattern

This ensures that there is only ever one instance of a class that inherits this one.

This is a subclass of ABCMeta so that it can be used as a metaclass of a subclass of an ABCMeta class.

zero.misc.db_to_mag(quantity)[source]
zero.misc.mag_to_db(quantity)[source]