Skip to content

Commit

Permalink
Merge branch 'main' into 2048-benchmarks-for-datetime-parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzCutNorman authored Nov 17, 2023
2 parents 04a2e8e + 5b84912 commit 4cb6f80
Show file tree
Hide file tree
Showing 31 changed files with 503 additions and 266 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pip==23.3.1
poetry==1.7.0
poetry==1.7.1
poetry-plugin-export==1.6.0
pre-commit==3.5.0
nox==2023.4.22
nox-poetry==1.0.3
8 changes: 6 additions & 2 deletions .github/workflows/cookiecutter-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ jobs:
pip --version
- name: Install Poetry
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install poetry
pipx inject poetry poetry-plugin-export
poetry --version
poetry self show plugins
- name: Setup Python ${{ matrix.python-version }}
uses: actions/[email protected]
Expand All @@ -59,8 +63,8 @@ jobs:
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
pipx install nox
pipx inject nox nox-poetry
nox --version
- name: Run Nox
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ jobs:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install poetry
pipx inject poetry poetry-plugin-export
poetry --version
poetry self show plugins
- name: Setup Python ${{ matrix.python-version }}
uses: actions/[email protected]
Expand All @@ -83,8 +85,8 @@ jobs:
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
pipx install nox
pipx inject nox nox-poetry
nox --version
- name: Run Nox
Expand Down Expand Up @@ -122,7 +124,9 @@ jobs:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install poetry
pipx inject poetry poetry-plugin-export
poetry --version
poetry self show plugins
- name: Setup Python 3.10
uses: actions/[email protected]
Expand All @@ -143,8 +147,8 @@ jobs:
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
pipx install nox
pipx inject nox nox-poetry
nox --version
- name: Run Nox
Expand All @@ -160,9 +164,13 @@ jobs:
uses: actions/[email protected]

- name: Install Poetry
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
pipx install poetry
pipx inject poetry poetry-plugin-export
poetry --version
poetry self show plugins
- name: Set up Python
uses: actions/[email protected]
Expand All @@ -185,8 +193,8 @@ jobs:
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
pipx install nox
pipx inject nox nox-poetry
nox --version
- name: Combine coverage data and display human readable report
Expand Down
82 changes: 41 additions & 41 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions samples/sample_tap_sqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class SQLiteTap(SQLTap):
DB_PATH_CONFIG,
th.StringType,
description="The path to your SQLite database file(s).",
required=True,
examples=["./path/to/my.db", "/absolute/path/to/my.db"],
),
).to_dict()
Expand Down
1 change: 1 addition & 0 deletions samples/sample_target_sqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SQLiteTarget(SQLTarget):
DB_PATH_CONFIG,
th.StringType,
description="The path to your SQLite database file(s).",
required=True,
),
).to_dict()

Expand Down
8 changes: 2 additions & 6 deletions singer_sdk/_singerlib/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ def __missing__(self, breadcrumb: Breadcrumb) -> bool:
Returns:
True if the breadcrumb is selected, False otherwise.
"""
if len(breadcrumb) >= 2: # noqa: PLR2004
parent = breadcrumb[:-2]
return self[parent]

return True
return self[breadcrumb[:-2]] if len(breadcrumb) >= 2 else True # noqa: PLR2004


@dataclass
Expand Down Expand Up @@ -71,7 +67,7 @@ def from_dict(cls: type[Metadata], value: dict[str, t.Any]) -> Metadata:
)

def to_dict(self) -> dict[str, t.Any]:
"""Convert metadata to a JSON-encodeable dictionary.
"""Convert metadata to a JSON-encodable dictionary.
Returns:
Metadata object.
Expand Down
22 changes: 9 additions & 13 deletions singer_sdk/authenticators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import base64
import math
import typing as t
from datetime import datetime, timedelta
from datetime import timedelta
from types import MappingProxyType
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit

Expand All @@ -19,6 +19,8 @@
if t.TYPE_CHECKING:
import logging

from pendulum import DateTime

from singer_sdk.streams.rest import RESTStream


Expand Down Expand Up @@ -378,7 +380,7 @@ def __init__(
# Initialize internal tracking attributes
self.access_token: str | None = None
self.refresh_token: str | None = None
self.last_refreshed: datetime | None = None
self.last_refreshed: DateTime | None = None
self.expires_in: int | None = None

@property
Expand Down Expand Up @@ -462,9 +464,7 @@ def client_id(self) -> str | None:
Returns:
Optional client secret from stream config if it has been set.
"""
if self.config:
return self.config.get("client_id")
return None
return self.config.get("client_id") if self.config else None

@property
def client_secret(self) -> str | None:
Expand All @@ -473,9 +473,7 @@ def client_secret(self) -> str | None:
Returns:
Optional client secret from stream config if it has been set.
"""
if self.config:
return self.config.get("client_secret")
return None
return self.config.get("client_secret") if self.config else None

def is_token_valid(self) -> bool:
"""Check if token is valid.
Expand All @@ -487,9 +485,7 @@ def is_token_valid(self) -> bool:
return False
if not self.expires_in:
return True
if self.expires_in > (utc_now() - self.last_refreshed).total_seconds():
return True
return False
return self.expires_in > (utc_now() - self.last_refreshed).total_seconds() # type: ignore[no-any-return]

# Authentication and refresh
def update_access_token(self) -> None:
Expand Down Expand Up @@ -520,7 +516,7 @@ def update_access_token(self) -> None:
self.expires_in = int(expiration) if expiration else None
if self.expires_in is None:
self.logger.debug(
"No expires_in receied in OAuth response and no "
"No expires_in received in OAuth response and no "
"default_expiration set. Token will be treated as if it never "
"expires.",
)
Expand Down Expand Up @@ -566,7 +562,7 @@ def oauth_request_body(self) -> dict:

@property
def oauth_request_payload(self) -> dict:
"""Return request paytload for OAuth request.
"""Return request payload for OAuth request.
Returns:
Payload object for OAuth.
Expand Down
3 changes: 0 additions & 3 deletions singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,6 @@ def merge_sql_types(
if issubclass(
generic_type,
(sqlalchemy.types.String, sqlalchemy.types.Unicode),
) or issubclass(
generic_type,
(sqlalchemy.types.String, sqlalchemy.types.Unicode),
):
# If length None or 0 then is varchar max ?
if (
Expand Down
Loading

0 comments on commit 4cb6f80

Please sign in to comment.