forked from p15670423/monkey
Common: Remove unneeded code for freezing lists to tuples
This commit is contained in:
parent
f11e2dc8a1
commit
dda79c0809
|
@ -1,13 +0,0 @@
|
|||
from functools import wraps
|
||||
from typing import Callable
|
||||
|
||||
from common.utils.code_utils import freeze_lists_in_mapping
|
||||
|
||||
|
||||
def freeze_lists(function: Callable):
|
||||
@wraps(function)
|
||||
def wrapper(self, data, **kwargs):
|
||||
data = freeze_lists_in_mapping(data)
|
||||
return function(self, data, **kwargs)
|
||||
|
||||
return wrapper
|
|
@ -1,5 +1,4 @@
|
|||
import queue
|
||||
from collections.abc import MutableSequence
|
||||
from typing import Any, List, MutableMapping, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
@ -49,10 +48,3 @@ def del_key(mapping: MutableMapping[T, Any], key: T):
|
|||
del mapping[key]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
def freeze_lists_in_mapping(mapping: MutableMapping[str, Any]) -> MutableMapping[str, Any]:
|
||||
for key, value in mapping.items():
|
||||
if isinstance(value, MutableSequence):
|
||||
mapping[key] = tuple(value)
|
||||
return mapping
|
||||
|
|
Loading…
Reference in New Issue