From c2e81b4a146498409e54434736a25b210dba51ee Mon Sep 17 00:00:00 2001 From: Coetzee van Staden Date: Sun, 9 Feb 2025 20:15:52 +0000 Subject: [PATCH] update(lint): revert type-checking add from prev commit + clean_up changes --- tap_mysql/client.py | 11 ++++------- tap_mysql/tap.py | 10 +++------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tap_mysql/client.py b/tap_mysql/client.py index e9f63c0..20e503d 100644 --- a/tap_mysql/client.py +++ b/tap_mysql/client.py @@ -3,7 +3,7 @@ from __future__ import annotations import datetime -from typing import TYPE_CHECKING, Any, TypeAlias +from typing import TYPE_CHECKING, Any import singer_sdk.helpers._typing import sqlalchemy @@ -12,13 +12,13 @@ from singer_sdk._singerlib import CatalogEntry, MetadataMapping, Schema from singer_sdk.helpers._typing import TypeConformanceLevel from sqlalchemy import text -from sqlalchemy.engine.reflection import ReflectedValue if TYPE_CHECKING: from collections.abc import Iterable from sqlalchemy.engine import Engine - from sqlalchemy.engine.reflection import Inspector + from sqlalchemy.engine.reflection import Inspector, ReflectedPrimaryKeyConstraint + unpatched_conform = ( singer_sdk.helpers._typing._conform_primitive_property # noqa: SLF001 @@ -218,9 +218,6 @@ def get_schema_names(self, engine: Engine, inspected: Inspector) -> list[str]: return self.config["filter_schemas"] return super().get_schema_names(engine, inspected) - # Create a new type alias for the reflected_pk type - ReflectedPKType: TypeAlias = list[ReflectedValue] | ReflectedValue | None - def discover_catalog_entry( # noqa: PLR0913 self, engine: Engine, @@ -230,7 +227,7 @@ def discover_catalog_entry( # noqa: PLR0913 is_view: bool, # noqa: FBT001 *, reflected_columns: list[Any] | None = None, - reflected_pk: ReflectedPKType = None, + reflected_pk: ReflectedPrimaryKeyConstraint | None = None, reflected_indices: list[Any] | None = None, ) -> CatalogEntry: """Create `CatalogEntry` object for the given table or a view. diff --git a/tap_mysql/tap.py b/tap_mysql/tap.py index b2cdd52..5c557b4 100644 --- a/tap_mysql/tap.py +++ b/tap_mysql/tap.py @@ -297,13 +297,9 @@ def ssh_tunnel_connect(self, *, ssh_config: dict[str, Any], url: URL) -> URL: def clean_up(self) -> None: """Stop the SSH Tunnel.""" - try: - if self.logger and self.logger.handlers: - self.logger.info("Shutting down SSH Tunnel") - except Exception as e: - print(f"Error logging shutdown: {e}") - finally: - self.ssh_tunnel.stop() + if self.logger and self.logger.handlers: + self.logger.info("Shutting down SSH Tunnel") + self.ssh_tunnel.stop() def catch_signal(self, signum, frame) -> None: # noqa: ANN001 ARG002 """Catch signals and exit cleanly.