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