rpymostat-common

PyPi package version PyPi downloads GitHub Forks GitHub Open Issues Project Status: Active - The project has reached a stable, usable state and is being actively developed.

Master:

travis-ci for master branch Code Health coverage report for master branch sphinx documentation for latest release

Develop:

travis-ci for develop branch Code Health coverage report for develop branch sphinx documentation for develop branch

Contents

rpymostat_common

rpymostat_common package

Submodules

rpymostat_common.discovery module
class rpymostat_common.discovery.EngineDiscoverer[source]

Bases: object

Class to discover RPyMostat Engine over the network (mDNS / Avahi / DNS-SD)

rpymostat_common.discovery.discover_engine()[source]

Discover the RPyMostat Engine over the network, using mDNS / DNS-SD.

Returns:2-tuple of (engine_addr, engine_port) if discovered before a timeout is reached, otherwise raise a DiscoveryTimeoutException.
rpymostat_common.loader module
rpymostat_common.loader._get_varnames(klass)[source]

Return a dict of variable names that klass’s init method takes, to string descriptions of them (if present).

Parameters:klass (abc.ABCMeta) – the class to get varnames for (from its __init__ method)
Returns:dict
rpymostat_common.loader._parse_docstring(docstring)[source]

Given a docstring, attempt to parse out all :param foo: and :type foo: directives and their matching strings, collapsing whitespace. Return a dict of keys ‘params’ and ‘types’, each being a dict of name to string.

Parameters:docstring (str) – docstring to parse
Return type:dict
rpymostat_common.loader.list_classes(classes)[source]

Given a list of class objects, print their names, along with their _description attributes (if present) and any arguments they accept. Used in building dynamic CLI help.

rpymostat_common.loader.load_classes(entrypoint_name, superclass=None)[source]

Attempt to load all pkg_resources entrypoints matching the given name, and return a list of the objects they load (usually classes). If superclass is specified, restrict the returned list to those which are subclasses of superclass.

Parameters:
  • entrypoint_name (str) – name of the entrypoint to load
  • superclass (class or classinfo) – if specified, restrict the return value to only subclasses of this class / classinfo
Returns:

list of loaded entrypoints (usually classes)

Return type:

list

rpymostat_common.unique_ids module
class rpymostat_common.unique_ids.SystemID[source]

Bases: object

Determine and retrieve a unique system ID for the hardware this is running on.

id_methods = ['raspberrypi_cpu', 'uuid_getnode']
id_string

Find/calculate and return the unique system ID string for the hardware this is running on.

Internally, this calls all method whose names are listed in id_methods, in order, and returns the value of the first one that returned something other than None.

Returns:unique, never-changing system ID
Return type:str
proc_cpuinfo_hw_re = <_sre.SRE_Pattern object>
proc_cpuinfo_rev_re = <_sre.SRE_Pattern object>
proc_cpuinfo_serial_re = <_sre.SRE_Pattern object>
random_fallback()[source]

Generate a host ID using a random UUID via Python’s uuid.uuid4(). Used as a fallback when the ID can’t be determined using any other method.

Returns:random UUID
Return type:str
raspberrypi_cpu()[source]

If this system is a Raspberry Pi, get its model and (CPU) serial number.

Thanks to: http://elinux.org/RPi_HardwareHistory#Board_Revision_History

Returns:RaspberryPi serial number
Return type:str
rpi_hardware = ['BCM2708', 'BCM2709']
rpi_revisions = {'0015': 'A+ 1.1 256MB (Embest)', '0014': 'Compute Module 1.0 512MB (Q2 2014 Embest)', '0013': 'B+ 1.2 512MB (Q1 2015)', '0012': 'A+ 1.1 256MB (Q4 2014 Sony)', '0011': 'Compute Module 1.0 512MB (Q2 2014 Sony)', '0010': 'B+ 1.0 512MB (Q3 2014 Sony)', '000d': 'B 2.0 512MB (Q4 2012 Egoman)', '000e': 'B 2.0 512MB (Q4 2012 Sony)', '000f': 'B 2.0 512MB (Q4 2012 Qisda)', 'a22082': '3 Model B 1.2 1024MB (Q1 2016)', 'Beta': 'B (Beta) ? 256MB (Q1 2012 Beta Board)', '900092': 'Zero 1.2 512MB (Q4 2015 Sony)', '900093': 'Zero 1.3 512MB (Q2 2016)', '0004': 'B 2.0 256MB (Q3 2012 Sony)', '0005': 'B 2.0 256MB (Q4 2012 Qisda)', '0006': 'B 2.0 256MB (Q4 2012 Egoman)', '0007': 'A 2.0 256MB (Q1 2013 Egoman)', '0002': 'B 1.0 256MB (Q1 2012)', '0003': 'B ECN0001 1.0 256MB (Q3 2012)', '0008': 'A 2.0 256MB (Q1 2013 Sony)', '0009': 'A 2.0 256MB (Q1 2013 Qisda)', 'a01041': '2 Model B 1.1 1GB (Q1 2015 Sony)', 'a02082': '3 Model B 1.2 1024MB (Q1 2016 Sony)', 'a21041': '2 Model B 1.1 1GB (Q1 2015 Embest)'}
uuid_getnode()[source]

Determine this system’s UUID via Python’s uuid.getnode() (slow) method.

Returns:hardware system ID from Python’s uuid.getnode()
Return type:str
rpymostat_common.version module

Changelog

x.y.z (YYYY-MM-DD)

  • something

Indices and tables

License

rpymostat-common is licensed under the GNU Affero General Public License, version 3 or later.