Skip to content

Commit

Permalink
Merge branch 'main' into feat-handle-sync-abort
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Payne authored Mar 30, 2023
2 parents 3ae02e8 + 131d701 commit 245c4fa
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 24 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ select = [
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PGH", # pygrep-hooks
"RUF", # ruff
]
src = ["samples", "singer_sdk", "tests"]
target-version = "py37"
Expand Down
10 changes: 0 additions & 10 deletions samples/sample_tap_google_analytics/ga_tap_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ def prepare_request_payload(
"viewId": self.config["view_id"],
"metrics": [{"expression": m} for m in self.metrics],
"dimensions": [{"name": d} for d in self.dimensions],
# "orderBys": [
# { # noqa: ERA001
# "fieldName": "ga:sessions", # noqa: ERA001
# "sortOrder": "DESCENDING", # noqa: ERA001
# },
# { # noqa: ERA001
# "fieldName": "ga:pageviews", # noqa: ERA001
# "sortOrder": "DESCENDING", # noqa: ERA001
# },
# ],
}
if self.config.get("start_date"):
request_def["dateRanges"] = [
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def discover_catalog_entry(
# a replication_key value.
# - 'LOG_BASED' replication must be enabled by the developer, according
# to source-specific implementation capabilities.
replication_method = next(reversed(["FULL_TABLE"] + addl_replication_methods))
replication_method = next(reversed(["FULL_TABLE", *addl_replication_methods]))

# Create the catalog entry object
return CatalogEntry(
Expand Down
8 changes: 5 additions & 3 deletions singer_sdk/helpers/_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ def _pop_deselected_schema(
return

for property_name, property_def in list(schema_at_breadcrumb["properties"].items()):
property_breadcrumb: tuple[str, ...] = tuple(
list(breadcrumb) + ["properties", property_name],
property_breadcrumb: tuple[str, ...] = (
*breadcrumb,
"properties",
property_name,
)
selected = mask[property_breadcrumb]
if not selected:
Expand Down Expand Up @@ -89,7 +91,7 @@ def pop_deselected_record_properties(
updating in place.
"""
for property_name, val in list(record.items()):
property_breadcrumb = breadcrumb + ("properties", property_name)
property_breadcrumb = (*breadcrumb, "properties", property_name)
selected = mask[property_breadcrumb]
if not selected:
record.pop(property_name)
Expand Down
6 changes: 3 additions & 3 deletions singer_sdk/helpers/_flattening.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def flatten_key(key_name: str, parent_keys: list[str], separator: str = "__") ->
>>> flatten_key("foo", ["bar", "baz"], separator=".")
'bar.baz.foo'
"""
full_key = parent_keys + [key_name]
full_key = [*parent_keys, key_name]
inflected_key = full_key.copy()
reducer_index = 0
while len(separator.join(inflected_key)) >= 255 and reducer_index < len(
Expand Down Expand Up @@ -241,7 +241,7 @@ def _flatten_schema(
items.extend(
_flatten_schema(
v,
parent_keys + [k],
[*parent_keys, k],
separator=separator,
level=level + 1,
max_level=max_level,
Expand Down Expand Up @@ -334,7 +334,7 @@ def _flatten_record(
_flatten_record(
v,
flattened_schema,
parent_key + [k],
[*parent_key, k],
separator=separator,
level=level + 1,
max_level=max_level,
Expand Down
4 changes: 2 additions & 2 deletions singer_sdk/helpers/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class TypeConformanceLevel(Enum):
"""


def conform_record_data_types( # noqa: C901
def conform_record_data_types(
stream_name: str,
record: dict[str, Any],
schema: dict,
Expand All @@ -368,7 +368,7 @@ def _conform_record_data_types(
schema: dict,
level: TypeConformanceLevel,
parent: str | None,
) -> tuple[dict[str, Any], list[str]]: # noqa: C901
) -> tuple[dict[str, Any], list[str]]:
"""Translate values in record dictionary to singer-compatible data types.
Any property names not found in the schema catalog will be removed, and a single
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/streams/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def request_records(self, context: dict | None) -> Iterable[dict]:

def _write_request_duration_log(
self,
endpoint: str, # noqa: ARG002
endpoint: str,
response: requests.Response,
context: dict | None,
extra_tags: dict | None,
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/testing/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def target_input(self) -> IO[str]:
if self.input_io:
self._input = self.input_io
elif self.input_filepath:
self._input = Path(self.input_filepath).open() # noqa: SIM115
self._input = Path(self.input_filepath).open()
return cast(IO[str], self._input)

@target_input.setter
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class DummyCapabilitiesEnum(CapabilitiesEnum):
def test_deprecated_capabilities():
with warnings.catch_warnings():
warnings.simplefilter("error")
DummyCapabilitiesEnum.MY_SUPPORTED_FEATURE
_ = DummyCapabilitiesEnum.MY_SUPPORTED_FEATURE

with pytest.warns(
DeprecationWarning,
match="is deprecated. No longer supported",
) as record:
DummyCapabilitiesEnum.MY_DEPRECATED_FEATURE
_ = DummyCapabilitiesEnum.MY_DEPRECATED_FEATURE

warning = record.list[0]
frameinfo = getframeinfo(currentframe())
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_connector_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_deprecated_functions_warn(self, connector):
with pytest.deprecated_call():
connector.create_sqlalchemy_connection()
with pytest.deprecated_call():
connector.connection
_ = connector.connection

def test_connect_calls_engine(self, connector):
with mock.patch.object(
Expand Down

0 comments on commit 245c4fa

Please sign in to comment.