Skip to content
Snippets Groups Projects
Commit c5d3d4e7 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

deprecated DictionaryView

parent d3939f31
No related branches found
No related tags found
No related merge requests found
# v2.14.22
* renamed `current_severity_level` to `severity_level` in `MemoryPressureManager`
* deprecated `DictionaryView`
__version__ = '2.14.22_a2'
__version__ = '2.14.22_a3'
import copy
import typing as tp
import warnings
from satella.coding.typing import K, V
......@@ -212,6 +213,11 @@ class DictionaryView(tp.MutableMapping[K, V]):
>>> del dv[1]
>>> assertRaises(KeyError, lambda: dv.__delitem__(1))
.. deprecated:: 2.14.22
Use ChainMap_ instead.
.. _ChainMap: https://docs.python.org/3/library/collections.html#collections.ChainMap
:param master_dict: First dictionary to look up. Entries made via __setitem__ will be put here.
:param rest_of_dicts: Remaining dictionaries
:param propagate_deletes: Whether to delete given key from the first dictionary that it is
......@@ -232,6 +238,8 @@ class DictionaryView(tp.MutableMapping[K, V]):
def __init__(self, master_dict: tp.Dict[K, V], *rest_of_dicts: tp.Dict[K, V],
propagate_deletes: bool = True,
assign_to_same_dict: bool = True):
warnings.warn('This is deprecated and will be removed in Satella 3.0.'
'Use collections.ChainMap instead', DeprecationWarning)
self.assign_to_same_dict = assign_to_same_dict
self.master_dict = master_dict
self.dictionaries = [master_dict, *rest_of_dicts]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment