AttrDict (internal)#
Copyright (c) 2013 Brendan Curran-Johnson
- class AttrDict(*args, **kwargs) None #
Bases:
Dict
[str
,V
],MutableAttr
[V
]A dict that implements MutableAttr.
- class MutableAttr#
Bases:
Attr
[str
,V
],MutableMapping
[str
,V
],ABC
A
mixin
mapping class that allows for attribute-style access of values.
- class Attr#
-
A
mixin
class for a mapping that allows for attribute-style access of values.- A key may be used as an attribute if:
It is a string
It matches
^[A-Za-z][A-Za-z0-9_]*$
(i.e., a public attribute)The key doesn’t overlap with any class attributes (for
Attr
, those would beget
,items
,keys
,values
,mro
, andregister
).
If a value which is accessed as an attribute is a Sequence-type (and is not a string/bytes), it will be converted to a _sequence_type with any mappings within it converted to Attrs.
- NOTE:
This means that if _sequence_type is not None, then a sequence accessed as an attribute will be a different object than if accessed as an attribute than if it is accessed as an item.