Skip to content

Commit bcbe64e

Browse files
committed
Deprecate a few unused functions in utils.py
Signed-off-by: Fabrice Normandin <fabrice.normandin@gmail.com>
1 parent 6c227b4 commit bcbe64e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

simple_parsing/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
overload,
3737
)
3838

39-
from typing_extensions import Literal, Protocol, TypeGuard, get_args, get_origin
39+
from typing_extensions import Literal, Protocol, TypeGuard, deprecated, get_args, get_origin
4040

4141
# There are cases where typing.Literal doesn't match typing_extensions.Literal:
4242
# https://github.com/python/typing_extensions/pull/148
@@ -115,6 +115,7 @@ def __init__(self, *args, **kwargs):
115115
super().__init__(*args, **kwargs)
116116

117117

118+
@deprecated("This is unused internally and will be removed soon.")
118119
def camel_case(name):
119120
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
120121
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower()
@@ -614,6 +615,7 @@ def get_container_nargs(container_type: type) -> int | str:
614615
raise NotImplementedError(f"Not sure what 'nargs' should be for type {container_type}")
615616

616617

618+
@deprecated("This is likely going to be removed soon.")
617619
def _parse_multiple_containers(
618620
container_type: type, append_action: bool = False
619621
) -> Callable[[str], list[Any]]:
@@ -888,6 +890,7 @@ def dict_union(*dicts: dict[K, V], recurse: bool = True, dict_factory=dict) -> d
888890
return result
889891

890892

893+
@deprecated("This is buggy and unused internally and will be removed soon.")
891894
def flatten(nested: PossiblyNestedMapping[K, V]) -> dict[tuple[K, ...], V]:
892895
"""Flatten a dictionary of dictionaries. The returned dictionary's keys are tuples, one entry
893896
per layer.
@@ -954,16 +957,19 @@ def unflatten_split(
954957
return unflatten({tuple(key.split(sep)): value for key, value in flattened.items()})
955958

956959

960+
@deprecated("This is unused internally and will be removed soon.")
957961
@overload
958962
def getitem_recursive(d: PossiblyNestedDict[K, V], keys: Iterable[K]) -> V:
959963
...
960964

961965

966+
@deprecated("This is unused internally and will be removed soon.")
962967
@overload
963968
def getitem_recursive(d: PossiblyNestedDict[K, V], keys: Iterable[K], default: T) -> V | T:
964969
...
965970

966971

972+
@deprecated("This is unused internally and will be removed soon.")
967973
def getitem_recursive(
968974
d: PossiblyNestedDict[K, V], keys: Iterable[K], default: T | _MISSING_TYPE = MISSING
969975
) -> V | T:

0 commit comments

Comments
 (0)