Skip to content

Commit dfcec5f

Browse files
chore: Leverage typing-only imports to avoid importing the base class (#1664)
1 parent b45d405 commit dfcec5f

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

singer_sdk/authenticators.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
if t.TYPE_CHECKING:
2020
import logging
2121

22-
from singer_sdk.streams import Stream as RESTStreamBase
22+
from singer_sdk.streams.rest import RESTStream
2323

2424

2525
def _add_parameters(initial_url: str, extra_parameters: dict) -> str:
@@ -83,7 +83,7 @@ def __call__(cls, *args: t.Any, **kwargs: t.Any) -> t.Any: # noqa: ANN401
8383
class APIAuthenticatorBase:
8484
"""Base class for offloading API auth."""
8585

86-
def __init__(self, stream: RESTStreamBase) -> None:
86+
def __init__(self, stream: RESTStream) -> None:
8787
"""Init authenticator.
8888
8989
Args:
@@ -172,7 +172,7 @@ class SimpleAuthenticator(APIAuthenticatorBase):
172172

173173
def __init__(
174174
self,
175-
stream: RESTStreamBase,
175+
stream: RESTStream,
176176
auth_headers: dict | None = None,
177177
) -> None:
178178
"""Create a new authenticator.
@@ -202,7 +202,7 @@ class APIKeyAuthenticator(APIAuthenticatorBase):
202202

203203
def __init__(
204204
self,
205-
stream: RESTStreamBase,
205+
stream: RESTStream,
206206
key: str,
207207
value: str,
208208
location: str = "header",
@@ -237,7 +237,7 @@ def __init__(
237237
@classmethod
238238
def create_for_stream(
239239
cls: type[APIKeyAuthenticator],
240-
stream: RESTStreamBase,
240+
stream: RESTStream,
241241
key: str,
242242
value: str,
243243
location: str,
@@ -265,7 +265,7 @@ class BearerTokenAuthenticator(APIAuthenticatorBase):
265265
'Bearer '. The token will be merged with HTTP headers on the stream.
266266
"""
267267

268-
def __init__(self, stream: RESTStreamBase, token: str) -> None:
268+
def __init__(self, stream: RESTStream, token: str) -> None:
269269
"""Create a new authenticator.
270270
271271
Args:
@@ -282,7 +282,7 @@ def __init__(self, stream: RESTStreamBase, token: str) -> None:
282282
@classmethod
283283
def create_for_stream(
284284
cls: type[BearerTokenAuthenticator],
285-
stream: RESTStreamBase,
285+
stream: RESTStream,
286286
token: str,
287287
) -> BearerTokenAuthenticator:
288288
"""Create an Authenticator object specific to the Stream class.
@@ -308,7 +308,7 @@ class BasicAuthenticator(APIAuthenticatorBase):
308308

309309
def __init__(
310310
self,
311-
stream: RESTStreamBase,
311+
stream: RESTStream,
312312
username: str,
313313
password: str,
314314
) -> None:
@@ -331,7 +331,7 @@ def __init__(
331331
@classmethod
332332
def create_for_stream(
333333
cls: type[BasicAuthenticator],
334-
stream: RESTStreamBase,
334+
stream: RESTStream,
335335
username: str,
336336
password: str,
337337
) -> BasicAuthenticator:
@@ -354,7 +354,7 @@ class OAuthAuthenticator(APIAuthenticatorBase):
354354

355355
def __init__(
356356
self,
357-
stream: RESTStreamBase,
357+
stream: RESTStream,
358358
auth_endpoint: str | None = None,
359359
oauth_scopes: str | None = None,
360360
default_expiration: int | None = None,

singer_sdk/streams/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
if t.TYPE_CHECKING:
5656
import logging
5757

58-
from singer_sdk.plugin_base import PluginBase as TapBaseClass
58+
from singer_sdk.tap_base import Tap
5959

6060
# Replication methods
6161
REPLICATION_FULL_TABLE = "FULL_TABLE"
@@ -130,7 +130,7 @@ class Stream(metaclass=abc.ABCMeta):
130130

131131
def __init__(
132132
self,
133-
tap: TapBaseClass,
133+
tap: Tap,
134134
schema: str | PathLike | dict[str, t.Any] | singer.Schema | None = None,
135135
name: str | None = None,
136136
) -> None:

singer_sdk/streams/rest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from backoff.types import Details
3333

3434
from singer_sdk._singerlib import Schema
35-
from singer_sdk.plugin_base import PluginBase as TapBaseClass
35+
from singer_sdk.tap_base import Tap
3636

3737
if sys.version_info >= (3, 10):
3838
from typing import TypeAlias # noqa: ICN003
@@ -75,7 +75,7 @@ def url_base(self) -> str:
7575

7676
def __init__(
7777
self,
78-
tap: TapBaseClass,
78+
tap: Tap,
7979
name: str | None = None,
8080
schema: dict[str, t.Any] | Schema | None = None,
8181
path: str | None = None,

singer_sdk/streams/sql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from singer_sdk.streams.core import Stream
1414

1515
if t.TYPE_CHECKING:
16-
from singer_sdk.plugin_base import PluginBase as TapBaseClass
16+
from singer_sdk.tap_base import Tap
1717

1818

1919
class SQLStream(Stream, metaclass=abc.ABCMeta):
@@ -23,7 +23,7 @@ class SQLStream(Stream, metaclass=abc.ABCMeta):
2323

2424
def __init__(
2525
self,
26-
tap: TapBaseClass,
26+
tap: Tap,
2727
catalog_entry: dict,
2828
connector: SQLConnector | None = None,
2929
) -> None:

0 commit comments

Comments
 (0)