Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 25, 2023
1 parent fd74ff0 commit 97ba092
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions singer_sdk/helpers/_flattening.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ def _flatten_schema( # noqa: C901
else:
items.append((new_key, v))
elif len(v.values()) > 0:
if list(v.values())[0][0]["type"] == "string":
list(v.values())[0][0]["type"] = ["null", "string"]
items.append((new_key, list(v.values())[0][0]))
elif list(v.values())[0][0]["type"] == "array":
list(v.values())[0][0]["type"] = ["null", "array"]
items.append((new_key, list(v.values())[0][0]))
elif list(v.values())[0][0]["type"] == "object":
list(v.values())[0][0]["type"] = ["null", "object"]
items.append((new_key, list(v.values())[0][0]))
if next(iter(v.values()))[0]["type"] == "string":
next(iter(v.values()))[0]["type"] = ["null", "string"]
items.append((new_key, next(iter(v.values()))[0]))

Check warning on line 257 in singer_sdk/helpers/_flattening.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_flattening.py#L256-L257

Added lines #L256 - L257 were not covered by tests
elif next(iter(v.values()))[0]["type"] == "array":
next(iter(v.values()))[0]["type"] = ["null", "array"]
items.append((new_key, next(iter(v.values()))[0]))

Check warning on line 260 in singer_sdk/helpers/_flattening.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_flattening.py#L259-L260

Added lines #L259 - L260 were not covered by tests
elif next(iter(v.values()))[0]["type"] == "object":
next(iter(v.values()))[0]["type"] = ["null", "object"]
items.append((new_key, next(iter(v.values()))[0]))

Check warning on line 263 in singer_sdk/helpers/_flattening.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_flattening.py#L262-L263

Added lines #L262 - L263 were not covered by tests

# Sort and check for duplicates
def _key_func(item):
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def _jsonschema_type_check(jsonschema_type: dict, type_check: tuple[str]) -> boo
if schema_type in type_check:
return True
else:
if jsonschema_type.get("type") in type_check: # noqa: PLR5501
if jsonschema_type.get("type") in type_check:
return True

if any(
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_jsonschema_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def test_property_creation(
property_dict = property_obj.to_dict()
assert property_dict == expected_jsonschema
for check_fn in TYPE_FN_CHECKS:
property_name = list(property_dict.keys())[0]
property_name = next(iter(property_dict.keys()))
property_node = property_dict[property_name]
if check_fn in type_fn_checks_true:
assert (
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/test_tap_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_tap_sqlite_cli(sqlite_sample_db_config: dict[str, t.Any], tmp_path: Pat
def test_sql_metadata(sqlite_sample_tap: SQLTap):
stream = t.cast(SQLStream, sqlite_sample_tap.streams["main-t1"])
detected_metadata = stream.catalog_entry["metadata"]
detected_root_md = [md for md in detected_metadata if md["breadcrumb"] == []][0]
detected_root_md = next(md for md in detected_metadata if md["breadcrumb"] == [])
detected_root_md = detected_root_md["metadata"]
translated_metadata = StreamMetadata.from_dict(detected_root_md)
assert detected_root_md["schema-name"] == translated_metadata.schema_name
Expand Down

0 comments on commit 97ba092

Please sign in to comment.