Skip to content

Commit

Permalink
chore: Leverage typing-only imports to avoid importing the base class (
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored May 3, 2023
1 parent b45d405 commit dfcec5f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions singer_sdk/authenticators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if t.TYPE_CHECKING:
import logging

from singer_sdk.streams import Stream as RESTStreamBase
from singer_sdk.streams.rest import RESTStream


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

def __init__(self, stream: RESTStreamBase) -> None:
def __init__(self, stream: RESTStream) -> None:
"""Init authenticator.
Args:
Expand Down Expand Up @@ -172,7 +172,7 @@ class SimpleAuthenticator(APIAuthenticatorBase):

def __init__(
self,
stream: RESTStreamBase,
stream: RESTStream,
auth_headers: dict | None = None,
) -> None:
"""Create a new authenticator.
Expand Down Expand Up @@ -202,7 +202,7 @@ class APIKeyAuthenticator(APIAuthenticatorBase):

def __init__(
self,
stream: RESTStreamBase,
stream: RESTStream,
key: str,
value: str,
location: str = "header",
Expand Down Expand Up @@ -237,7 +237,7 @@ def __init__(
@classmethod
def create_for_stream(
cls: type[APIKeyAuthenticator],
stream: RESTStreamBase,
stream: RESTStream,
key: str,
value: str,
location: str,
Expand Down Expand Up @@ -265,7 +265,7 @@ class BearerTokenAuthenticator(APIAuthenticatorBase):
'Bearer '. The token will be merged with HTTP headers on the stream.
"""

def __init__(self, stream: RESTStreamBase, token: str) -> None:
def __init__(self, stream: RESTStream, token: str) -> None:
"""Create a new authenticator.
Args:
Expand All @@ -282,7 +282,7 @@ def __init__(self, stream: RESTStreamBase, token: str) -> None:
@classmethod
def create_for_stream(
cls: type[BearerTokenAuthenticator],
stream: RESTStreamBase,
stream: RESTStream,
token: str,
) -> BearerTokenAuthenticator:
"""Create an Authenticator object specific to the Stream class.
Expand All @@ -308,7 +308,7 @@ class BasicAuthenticator(APIAuthenticatorBase):

def __init__(
self,
stream: RESTStreamBase,
stream: RESTStream,
username: str,
password: str,
) -> None:
Expand All @@ -331,7 +331,7 @@ def __init__(
@classmethod
def create_for_stream(
cls: type[BasicAuthenticator],
stream: RESTStreamBase,
stream: RESTStream,
username: str,
password: str,
) -> BasicAuthenticator:
Expand All @@ -354,7 +354,7 @@ class OAuthAuthenticator(APIAuthenticatorBase):

def __init__(
self,
stream: RESTStreamBase,
stream: RESTStream,
auth_endpoint: str | None = None,
oauth_scopes: str | None = None,
default_expiration: int | None = None,
Expand Down
4 changes: 2 additions & 2 deletions singer_sdk/streams/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
if t.TYPE_CHECKING:
import logging

from singer_sdk.plugin_base import PluginBase as TapBaseClass
from singer_sdk.tap_base import Tap

# Replication methods
REPLICATION_FULL_TABLE = "FULL_TABLE"
Expand Down Expand Up @@ -130,7 +130,7 @@ class Stream(metaclass=abc.ABCMeta):

def __init__(
self,
tap: TapBaseClass,
tap: Tap,
schema: str | PathLike | dict[str, t.Any] | singer.Schema | None = None,
name: str | None = None,
) -> None:
Expand Down
4 changes: 2 additions & 2 deletions singer_sdk/streams/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from backoff.types import Details

from singer_sdk._singerlib import Schema
from singer_sdk.plugin_base import PluginBase as TapBaseClass
from singer_sdk.tap_base import Tap

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

def __init__(
self,
tap: TapBaseClass,
tap: Tap,
name: str | None = None,
schema: dict[str, t.Any] | Schema | None = None,
path: str | None = None,
Expand Down
4 changes: 2 additions & 2 deletions singer_sdk/streams/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from singer_sdk.streams.core import Stream

if t.TYPE_CHECKING:
from singer_sdk.plugin_base import PluginBase as TapBaseClass
from singer_sdk.tap_base import Tap


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

def __init__(
self,
tap: TapBaseClass,
tap: Tap,
catalog_entry: dict,
connector: SQLConnector | None = None,
) -> None:
Expand Down

0 comments on commit dfcec5f

Please sign in to comment.