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 Nov 29, 2024
1 parent 4026cac commit 537e914
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def get_sqlalchemy_url(self, config: dict[str, t.Any]) -> str: # noqa: PLR6301
msg = "Could not find or create 'sqlalchemy_url' for connection."
raise ConfigValidationError(msg)

return t.cast(str, config["sqlalchemy_url"])
return t.cast("str", config["sqlalchemy_url"])

def to_jsonschema_type(
self,
Expand Down Expand Up @@ -1429,7 +1429,7 @@ def _get_type_sort_key(

_len = int(getattr(sql_type, "length", 0) or 0)

_pytype = t.cast(type, sql_type.python_type)
_pytype = t.cast("type", sql_type.python_type)
if issubclass(_pytype, (str, bytes)):
return 900, _len
if issubclass(_pytype, datetime):
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/helpers/_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_writeable_state_dict(
tap_state["bookmarks"] = {}
if tap_stream_id not in tap_state["bookmarks"]:
tap_state["bookmarks"][tap_stream_id] = {}
stream_state = t.cast(dict, tap_state["bookmarks"][tap_stream_id])
stream_state = t.cast("dict", tap_state["bookmarks"][tap_stream_id])
if not state_partition_context:
return stream_state

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 @@ -187,11 +187,11 @@ def get_datelike_property_type(property_schema: dict) -> str | None:
Otherwise return None.
"""
if _is_string_with_format(property_schema):
return t.cast(str, property_schema["format"])
return t.cast("str", property_schema["format"])
if "anyOf" in property_schema:
for type_dict in property_schema["anyOf"]:
if _is_string_with_format(type_dict):
return t.cast(str, type_dict["format"])
return t.cast("str", type_dict["format"])
return None


Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/plugin_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def config(self) -> t.Mapping[str, t.Any]:
Returns:
A frozen (read-only) config dictionary map.
"""
return t.cast(dict, MappingProxyType(self._config))
return t.cast("dict", MappingProxyType(self._config))

@staticmethod
def _is_secret_config(config_key: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/tap_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def catalog_dict(self) -> dict:
Returns:
The tap's catalog as a dict
"""
return t.cast(dict, self._singer_catalog.to_dict())
return t.cast("dict", self._singer_catalog.to_dict())

@property
def catalog_json_text(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/testing/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _select_all(catalog_dict: dict) -> dict:
for catalog_entry in catalog.streams:
catalog_entry.metadata.root.selected = True

return t.cast(dict, catalog.to_dict())
return t.cast("dict", catalog.to_dict())


def target_sync_test(
Expand Down
6 changes: 3 additions & 3 deletions singer_sdk/testing/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def new_tap(self) -> Tap:
Returns:
A configured Tap instance.
"""
return t.cast(Tap, self.create())
return t.cast("Tap", self.create())

def run_discovery(self) -> str:
"""Run tap discovery.
Expand Down Expand Up @@ -233,7 +233,7 @@ def new_target(self) -> Target:
Returns:
A configured Target instance.
"""
return t.cast(Target, self.create())
return t.cast("Target", self.create())

@property
def target_input(self) -> t.IO[str]:
Expand All @@ -247,7 +247,7 @@ def target_input(self) -> t.IO[str]:
self._input = self.input_io
elif self.input_filepath:
self._input = self.input_filepath.open(encoding="utf8")
return t.cast(t.IO[str], self._input)
return t.cast("t.IO[str]", self._input)

@target_input.setter
def target_input(self, value: t.IO[str]) -> None:
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/testing/tap_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test(self) -> None:
catalog = tap1.catalog_dict
# Reset and re-initialize with discovered catalog
kwargs = {k: v for k, v in self.runner.default_kwargs.items() if k != "catalog"}
tap2: Tap = t.cast(type[Tap], self.runner.singer_class)(
tap2: Tap = t.cast("type[Tap]", self.runner.singer_class)(
config=self.runner.config,
catalog=catalog,
**kwargs,
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def type_dict(self) -> dict: # type: ignore[override]
# TODO: this should be a TypeError, but it's a breaking change.
raise ValueError(msg) # noqa: TRY004

return t.cast(dict, wrapped.type_dict)
return t.cast("dict", wrapped.type_dict)

def to_dict(self) -> dict:
"""Return a dict mapping the property name to its definition.
Expand Down

0 comments on commit 537e914

Please sign in to comment.