hikari.internal.attr_extensions#
Utility for extending and optimising the usage of attr
models.
Module Contents#
- hikari.internal.attr_extensions.invalidate_shallow_copy_cache()[source]#
Remove all the globally cached copy functions.
- hikari.internal.attr_extensions.invalidate_deep_copy_cache()[source]#
Remove all the globally cached generated deep copy functions.
- hikari.internal.attr_extensions.copy_attrs(model)[source]#
Shallow copy an attrs model with
init
enabled.- Parameters
- model
ModelT
The attrs model to shallow copy.
- model
- Returns
ModelT
The new shallow copied attrs model.
- hikari.internal.attr_extensions.deep_copy_attrs(model, memo=None)[source]#
Deep copy an attrs model with
init
enabled.Note
This won’t deep copy attributes where “skip_deep_copy” is set to
True
in their metadata.- Parameters
- model
ModelT
The attrs model to deep copy.
- memo
typing.Optional
[typing.MutableMapping
[int
,typing.Any
]] A memo dictionary of objects already copied during the current copying pass, see <https://docs.python.org/3/library/copy.html> for more details.
- model
- Returns
ModelT
The new deep copied attrs model.