Skip to content

Commit c6448e5

Browse files
fix: Add type casts for dpath.values and dpath.get to fix MyPy errors
MyPy was complaining that dpath.values() and dpath.get() return 'object' type. Added cast(Iterable[Any], ...) for dpath.values() and cast(Any, ...) for dpath.get() to satisfy MyPy type checking while maintaining runtime behavior. All 29 tests passing. MyPy check now passes. Co-Authored-By: unknown <>
1 parent c6a9d05 commit c6448e5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

airbyte_cdk/sources/declarative/expanders/record_expander.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
from dataclasses import InitVar, dataclass
6-
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Union
6+
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Union, cast
77

88
import dpath
99

@@ -69,7 +69,7 @@ def expand_record(self, record: MutableMapping[Any, Any]) -> Iterable[MutableMap
6969
expand_path = [path.eval(self.config) for path in self._expand_path]
7070

7171
if "*" in expand_path:
72-
matches = dpath.values(record, expand_path)
72+
matches = cast(Iterable[Any], dpath.values(record, expand_path))
7373
list_nodes = [m for m in matches if isinstance(m, list)]
7474
if not list_nodes:
7575
return
@@ -87,7 +87,7 @@ def expand_record(self, record: MutableMapping[Any, Any]) -> Iterable[MutableMap
8787
yield item
8888
else:
8989
try:
90-
nested_array = dpath.get(record, expand_path)
90+
nested_array = cast(Any, dpath.get(record, expand_path))
9191
except KeyError:
9292
return
9393

0 commit comments

Comments
 (0)