Common: Remove unneeded code for freezing lists to tuples

This commit is contained in:
Shreya Malviya 2022-08-30 12:52:16 +05:30
parent f11e2dc8a1
commit dda79c0809
2 changed files with 0 additions and 21 deletions

View File

@ -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

View File

@ -1,5 +1,4 @@
import queue import queue
from collections.abc import MutableSequence
from typing import Any, List, MutableMapping, TypeVar from typing import Any, List, MutableMapping, TypeVar
T = TypeVar("T") T = TypeVar("T")
@ -49,10 +48,3 @@ def del_key(mapping: MutableMapping[T, Any], key: T):
del mapping[key] del mapping[key]
except KeyError: except KeyError:
pass 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