Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions airbyte_cdk/connector_builder/connector_builder_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def should_migrate_manifest(config: Mapping[str, Any]) -> bool:

This flag is set by the UI.
"""
return config.get("__should_migrate", False)
return bool(config.get("__should_migrate", False))


def should_normalize_manifest(config: Mapping[str, Any]) -> bool:
Expand All @@ -57,7 +57,7 @@ def should_normalize_manifest(config: Mapping[str, Any]) -> bool:
:param config: The configuration to check
:return: True if the manifest should be normalized, False otherwise.
"""
return config.get("__should_normalize", False)
return bool(config.get("__should_normalize", False))


def create_source(
Expand Down
4 changes: 2 additions & 2 deletions airbyte_cdk/manifest_server/command_processor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def should_migrate_manifest(manifest: Mapping[str, Any]) -> bool:

This flag is set by the UI.
"""
return manifest.get(SHOULD_MIGRATE_KEY, False)
return bool(manifest.get(SHOULD_MIGRATE_KEY, False))


def should_normalize_manifest(manifest: Mapping[str, Any]) -> bool:
Expand All @@ -52,7 +52,7 @@ def should_normalize_manifest(manifest: Mapping[str, Any]) -> bool:

This flag is set by the UI.
"""
return manifest.get(SHOULD_NORMALIZE_KEY, False)
return bool(manifest.get(SHOULD_NORMALIZE_KEY, False))


def build_source(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def state(self, value: MutableMapping[str, Any]) -> None:
def cursor(self) -> Optional[AbstractFileBasedCursor]:
return self._cursor

@cursor.setter
@cursor.setter # type: ignore[override]
def cursor(self, value: AbstractFileBasedCursor) -> None:
if self._cursor is not None:
raise RuntimeError(
Expand Down
13 changes: 7 additions & 6 deletions airbyte_cdk/sources/streams/checkpoint/checkpoint_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,21 +245,22 @@ def __init__(

def next(self) -> Optional[Mapping[str, Any]]:
try:
self.current_slice = self._find_next_slice()
current = self._find_next_slice()
self.current_slice = current

if "partition" in dict(self.current_slice):
if "partition" in dict(current):
raise ValueError("Stream is configured to use invalid stream slice key 'partition'")
elif "cursor_slice" in dict(self.current_slice):
elif "cursor_slice" in dict(current):
raise ValueError(
"Stream is configured to use invalid stream slice key 'cursor_slice'"
)

# We convert StreamSlice to a regular mapping because legacy connectors operate on the basic Mapping object. We
# also duplicate all fields at the top level for backwards compatibility for existing Python sources
return {
"partition": self.current_slice.partition,
"cursor_slice": self.current_slice.cursor_slice,
**dict(self.current_slice),
"partition": current.partition,
"cursor_slice": current.cursor_slice,
**dict(current),
}
except StopIteration:
self._finished_sync = True
Expand Down
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ plugins = ["pydantic.mypy", "pytest-mypy-plugins"]

[mypy-airbyte_cdk.models]
ignore_errors = True

Loading