Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert datetime.utcnow -> datetime.now(UTC) #92

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

psi29a
Copy link

@psi29a psi29a commented Jun 11, 2024

Removes deprecation warning and makes a timezone (UTC) aware datetime object.

Screenshot 2024-06-11 at 14 45 30
  /Users/psi29a/Workspace/backend/venv/lib/python3.12/site-packages/pybreaker/__init__.py:257: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    self._state_storage.opened_at = datetime.utcnow()

  /Users/psi29a/Workspace/backend/venv/lib/python3.12/site-packages/pybreaker/__init__.py:766: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    if opened_at and datetime.utcnow() < opened_at + timeout:
    ```

Removes deprecation warning and makes a timezone (UTC) aware datetime object.
@danielfm danielfm self-assigned this Jul 4, 2024
@danielfm
Copy link
Owner

danielfm commented Jul 4, 2024

@psi29a There is a lint error in this PR. You can fix that by putting the UTC first in the import list.

@psi29a
Copy link
Author

psi29a commented Jul 12, 2024

Sure! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants