Skip to content

Commit

Permalink
refactor: Change to return type of utc_now from pendulum.DateTime
Browse files Browse the repository at this point in the history
… to `datetime.datetime` (#2453)
  • Loading branch information
edgarrmondragon authored May 27, 2024
1 parent 731fc35 commit abc43eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions singer_sdk/authenticators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import base64
import datetime
import math
import typing as t
import warnings
Expand All @@ -17,8 +18,6 @@
if t.TYPE_CHECKING:
import logging

from pendulum import DateTime

from singer_sdk.streams.rest import RESTStream


Expand Down Expand Up @@ -382,7 +381,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.datetime | None = None
self.expires_in: int | None = None

@property
Expand Down
6 changes: 5 additions & 1 deletion singer_sdk/helpers/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

import pendulum

if t.TYPE_CHECKING:
import datetime


def read_json_file(path: PurePath | str) -> dict[str, t.Any]:
"""Read json file, throwing an error if missing."""
Expand All @@ -25,6 +28,7 @@ def read_json_file(path: PurePath | str) -> dict[str, t.Any]:
return t.cast(dict, json.loads(Path(path).read_text(encoding="utf-8")))


def utc_now() -> pendulum.DateTime:
def utc_now() -> datetime.datetime:
"""Return current time in UTC."""
# TODO: replace with datetime.datetime.now(tz=datetime.timezone.utc)
return pendulum.now(tz="UTC")

0 comments on commit abc43eb

Please sign in to comment.