Skip to content

Commit 9d33042

Browse files
committed
CDK: rev mutableMapping -> Mapping
Signed-off-by: Artem Inzhyyants <artem.inzhyyants@gmail.com>
1 parent 31c2b1a commit 9d33042

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import copy
55
import logging
66
from dataclasses import InitVar, dataclass
7-
from typing import TYPE_CHECKING, Any, Iterable, List, Mapping, MutableMapping, Optional, Union
7+
from typing import TYPE_CHECKING, Any, Iterable, List, Mapping, Optional, Union
88

99
import dpath
1010

@@ -215,7 +215,7 @@ def _extract_extra_fields(
215215
self,
216216
parent_record: Mapping[str, Any] | AirbyteMessage,
217217
extra_fields: Optional[List[List[str]]] = None,
218-
) -> MutableMapping[str, Any]:
218+
) -> Mapping[str, Any]:
219219
"""
220220
Extracts additional fields specified by their paths from the parent record.
221221

airbyte_cdk/sources/declarative/requesters/http_job_repository.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,12 @@ def fetch_records(self, job: AsyncJob) -> Iterable[Mapping[str, Any]]:
189189
for url in self.urls_extractor.extract_records(
190190
self._polling_job_response_by_id[job.api_job_id()]
191191
):
192-
stream_slice = job.job_parameters()
193-
stream_slice.extra_fields.update({"url": url})
192+
job_slice = job.job_parameters()
193+
stream_slice = StreamSlice(
194+
partition=job_slice.partition,
195+
cursor_slice=job_slice.cursor_slice,
196+
extra_fields={**job_slice.extra_fields, "url": url},
197+
)
194198
for message in self.download_retriever.read_records({}, stream_slice):
195199
if isinstance(message, Record):
196200
yield message.data

airbyte_cdk/sources/types.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,7 @@
44

55
from __future__ import annotations
66

7-
from typing import (
8-
Any,
9-
ItemsView,
10-
Iterator,
11-
KeysView,
12-
List,
13-
Mapping,
14-
MutableMapping,
15-
Optional,
16-
ValuesView,
17-
)
7+
from typing import Any, ItemsView, Iterator, KeysView, List, Mapping, Optional, ValuesView
188

199
import orjson
2010

@@ -78,7 +68,7 @@ def __init__(
7868
*,
7969
partition: Mapping[str, Any],
8070
cursor_slice: Mapping[str, Any],
81-
extra_fields: Optional[MutableMapping[str, Any]] = None,
71+
extra_fields: Optional[Mapping[str, Any]] = None,
8272
) -> None:
8373
"""
8474
:param partition: The partition keys representing a unique partition in the stream.
@@ -112,7 +102,7 @@ def cursor_slice(self) -> Mapping[str, Any]:
112102
return c
113103

114104
@property
115-
def extra_fields(self) -> MutableMapping[str, Any]:
105+
def extra_fields(self) -> Mapping[str, Any]:
116106
"""Returns the extra fields that are not part of the partition."""
117107
return self._extra_fields
118108

0 commit comments

Comments
 (0)