Base Class¶
About¶
FrozenBase is the base class for frozendict
and FrozenOrderedDict. If you wish to
construct your own frozen dictionary classes, you may wish to inherit from
this class.
Usage¶
API Reference¶
-
class
cawdrey.base.FrozenBase(*args, **kwargs)[source]¶ Abstract Base Class for Frozen dictionaries
Used by frozendict and FrozenOrderedDict.
Custom subclasses must implement at a minimum
__init__,copy,fromkeys.-
__abstractmethods__= frozenset({'copy', '__init__'})¶
-
__class__¶ alias of
abc.ABCMeta
-
__contains__(key)¶
-
__copy__(*args, **kwargs)¶
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'cawdrey.base', '__doc__': '\n\tAbstract Base Class for Frozen dictionaries\n\t\n\tUsed by frozendict and FrozenOrderedDict.\n\t\n\tCustom subclasses must implement at a minimum ``__init__``,\n\t``copy``, ``fromkeys``.\n\t', 'dict_cls': None, '__init__': <function FrozenBase.__init__>, 'fromkeys': <classmethod object>, '__abstractmethods__': frozenset({'copy', '__init__'}), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 42})¶
-
__dir__() → list¶ default dir() implementation
-
__eq__(other)¶ Return self==value.
-
__format__()¶ default object formatter
-
__ge__¶ Return self>=value.
-
__getattribute__¶ Return getattr(self, name).
-
__getitem__(key)¶
-
__gt__¶ Return self>value.
-
__hash__= None¶
-
__init_subclass__()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__()¶
-
__le__¶ Return self<=value.
-
__len__()¶
-
__lt__¶ Return self<value.
-
__module__= 'cawdrey.base'¶
-
__ne__¶ Return self!=value.
-
__new__()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__()¶ helper for pickle
-
__reduce_ex__()¶ helper for pickle
-
__repr__()¶ Return repr(self).
-
__reversed__= None¶
-
__setattr__¶ Implement setattr(self, name, value).
-
__sizeof__() → int¶ size of object in memory, in bytes
-
__slots__= ()¶
-
__str__¶ Return str(self).
-
classmethod
__subclasshook__(C)¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__¶ list of weak references to the object (if defined)
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 42¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
copy(*args, **kwargs)¶
-
dict_cls= None¶
-
classmethod
fromkeys(*args, **kwargs)[source]¶ Returns a new dict with keys from iterable and values equal to value.
-
get(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
items() → a set-like object providing a view on D's items¶
-
keys() → a set-like object providing a view on D's keys¶
-
values() → an object providing a view on D's values¶
-