Skip to content

Commit 99b4e08

Browse files
committed
Fix mypy
1 parent a125c96 commit 99b4e08

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

airbyte_cdk/sources/declarative/resolvers/config_components_resolver.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from copy import deepcopy
66
from dataclasses import InitVar, dataclass, field
77
from itertools import product
8-
from typing import Any, Dict, Iterable, List, Mapping, Optional, Union
8+
from typing import Any, Dict, Iterable, List, Mapping, Optional, Union, Tuple
99

1010
import dpath
1111
from typing_extensions import deprecated
@@ -94,25 +94,22 @@ def __post_init__(self, parameters: Mapping[str, Any]) -> None:
9494
)
9595

9696
@property
97-
def _stream_config(self):
98-
def resolve_path(pointer):
97+
def _stream_config(self) -> List[Dict[str, Any]]:
98+
def resolve_path(pointer: List[Union[InterpolatedString, str]]) -> List[str]:
9999
return [
100100
node.eval(self.config) if not isinstance(node, str) else node for node in pointer
101101
]
102102

103-
def normalize_configs(configs):
104-
return configs if isinstance(configs, list) else [configs]
105-
106-
def prepare_streams():
103+
def prepare_streams() -> Iterable[List[Tuple[int, Any]]]:
107104
for stream_config in self.stream_configs:
108105
path = resolve_path(stream_config.configs_pointer)
109106
stream_configs = dpath.get(dict(self.config), path, default=[])
110-
stream_configs = normalize_configs(stream_configs)
107+
stream_configs = stream_configs if isinstance(stream_configs, list) else [stream_configs]
111108
if stream_config.default_values:
112109
stream_configs.extend(stream_config.default_values)
113110
yield [(i, item) for i, item in enumerate(stream_configs)]
114111

115-
def merge_combination(combo):
112+
def merge_combination(combo: Iterable[Tuple[int, Any]]) -> Dict[str, Any]:
116113
result = {}
117114
for config_index, (elem_index, elem) in enumerate(combo):
118115
if isinstance(elem, dict):

0 commit comments

Comments
 (0)