Skip to content

Commit d820212

Browse files
committed
🩹 Fix ruff complaints
1 parent ea8ec4c commit d820212

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/nested_dict_tools/_core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"""
2222

2323
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence
24-
from typing import Any, Literal, cast, overload, reveal_type
24+
from typing import Any, Literal, cast, overload
2525

2626
type NestedMapping[K, V] = Mapping[K, NestedMappingNode[K, V]]
2727
type NestedMappingNode[K, V] = V | NestedMapping[K, V]
@@ -72,7 +72,7 @@ def flatten_dict_gen(
7272
raise KeySeparatorCollisionError(k, sep)
7373
concat_key = parent_key + sep + k if parent_key is not None else k
7474
if isinstance(v, Mapping):
75-
yield from flatten_dict_gen(cast(NestedMapping[K, V], v), concat_key, sep)
75+
yield from flatten_dict_gen(cast("NestedMapping[K, V]", v), concat_key, sep)
7676
else:
7777
yield concat_key, v
7878

@@ -201,7 +201,7 @@ def set_deep[K, V](d: NestedMutableMapping[K, Any], keys: Sequence[K], value: An
201201
for key in keys[:-1]:
202202
try:
203203
# Raise TypeError if an existing key doesn't map to a dict
204-
sub_dict = cast(NestedMutableMapping[K, V], sub_dict[key])
204+
sub_dict = cast("NestedMutableMapping[K, V]", sub_dict[key])
205205
except KeyError:
206206
sub_dict[key] = sub_dict = {}
207207

@@ -296,9 +296,9 @@ def map_leaves[K, V, W](
296296
for key in dict1:
297297
args = (d[key] for d in nested_dicts)
298298
if isinstance(dict1[key], Mapping):
299-
dict_res[key] = map_leaves(func, *cast(Iterator[NestedMapping[K, V]], args))
299+
dict_res[key] = map_leaves(func, *cast("Iterator[NestedMapping[K, V]]", args))
300300
else:
301-
dict_res[key] = func(*cast(Iterator[V], args))
301+
dict_res[key] = func(*cast("Iterator[V]", args))
302302

303303
return dict_res
304304

@@ -333,7 +333,7 @@ def filter_leaves[K, V](
333333
for key in nested_dict:
334334
sub_dict = nested_dict[key]
335335
if isinstance(sub_dict, Mapping):
336-
filtered = filter_leaves(func, cast(NestedMapping[K, V], sub_dict), remove_empty)
336+
filtered = filter_leaves(func, cast("NestedMapping[K, V]", sub_dict), remove_empty)
337337
if filtered or not remove_empty:
338338
dict_res[key] = filtered
339339
else:

0 commit comments

Comments
 (0)