Source code for

# This file is part of the pyMOR project (
# Copyright 2013-2019 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (

# The following implementation is based on

[docs]class FrozenDict(dict): """An immutable dictionary.""" @property def _blocked_attribute(self): raise AttributeError('A frozendict cannot be modified.') __delitem__ = __setitem__ = clear = _blocked_attribute pop = popitem = setdefault = update = _blocked_attribute
[docs] def __new__(cls, *args, **kwargs): new = dict.__new__(cls) dict.__init__(new, *args, **kwargs) return new
def __init__(self, *args, **kwargs): pass
[docs] def __repr__(self): return f'FrozenDict({dict.__repr__(self)})'
[docs] def __reduce__(self): return (FrozenDict, (dict(self),))