8. pypsi.namespace - Arbitrary attribute storage classes¶
Generic objects to store arbitrary attributes and values.
-
class
pypsi.namespace.
Namespace
(**kwargs)[source]¶ Bases:
object
Provides dynamic attribute storage and retrieval. Attributes can be retrieved and set by either attribute accesses or
dict
key access. The following two lines of code retrieve and set the same attribute:namespace.my_attr = 1
namespace['my_attr'] = 1
Parameters: kwargs – default attributes and their values are created
-
class
pypsi.namespace.
ScopedNamespace
(name, case_sensitive=True, locals=None, parent=None)[source]¶ Bases:
object
Provides a configurable namespace for arbitrary attribute access.
Parameters: - name (str) – the root name
- case_sensitive (bool) – determines whether attribute names are case sensitive
- locals (dict) – default attributes
- parent (ScopedNamespace) – the parent namespace