boss.configuration¶
Classes¶
dict() -> new empty dictionary |
|
dict() -> new empty dictionary |
Functions¶
|
Return the argument names in which a HERO class receives HERORef values instead of RemoteHEROs. |
|
Replace |
Module Contents¶
- boss.configuration._heroref_arguments(classname: str) frozenset[str][source]¶
Return the argument names in which a HERO class receives HERORef values instead of RemoteHEROs.
The names are read from the class attribute
_boss_heroref_argumentsof the class given byclassname. Withwrap_targetset, this is the unwrapped class. Names that match no argument are ignored.- Parameters:
classname – dotted name of the class to be built
- Returns:
The argument names, empty if the class has no
_boss_heroref_arguments.- Raises:
TypeError – if
_boss_heroref_argumentsis a single string or contains a name that is not a string.
- boss.configuration._resolve_references(value: object, realm: str, *, as_ref: bool = False) object[source]¶
Replace
$namestrings at any depth with remote HEROs or, withas_ref, with HERORef values.A leading
$$is an escape: one$is stripped and the string is passed on literally. Dict keys are not resolved. Containers are rebuilt, the input is not modified.- Parameters:
value – argument value, possibly a nested dict, list or tuple
realm – realm in which the referenced HEROs are looked up or which the HERORef values carry
as_ref – build
HERORef(name, realm)instead of looking up a RemoteHERO
- Returns:
The value with all references resolved.
- class boss.configuration.Document[source]¶
Bases:
dictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- classmethod parse_string(s: str)[source]¶
Parse a document in JSON format from a string.
- Parameters:
s – string containing the JSON representation of the config
- classmethod parse_url(url: str)[source]¶
Parse a document in JSON format from a URL.
- Parameters:
url – any URL supported by urllib (e.g. file://local.json or https://user:pass@couch.db/database/my_doc)
- class boss.configuration.WorkerConfigurationDocument[source]¶
Bases:
Documentdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)