-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix utcfromtimestamp() deprecation warning #424
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adamchainz
requested changes
Mar 1, 2024
In python 3.12 the following DeprecationWarning datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC. This commit fixes it.
adamchainz
reviewed
Mar 1, 2024
tox.ini
Outdated
@@ -15,7 +15,6 @@ commands = | |||
-W error::ResourceWarning \ | |||
-W error::DeprecationWarning \ | |||
-W error::PendingDeprecationWarning \ | |||
-W ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's also a warning from dateutil that needs suppressing, so unfortunately I need to restore this
adamchainz
changed the title
Fix a utcfromtimestamp warning
Fix utcfromtimestamp() deprecation warning
Mar 1, 2024
inmantaci
pushed a commit
to inmanta/inmanta-core
that referenced
this pull request
Mar 4, 2024
Bumps [time-machine](https://github.com/adamchainz/time-machine) from 2.13.0 to 2.14.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/adamchainz/time-machine/blob/main/CHANGELOG.rst">time-machine's changelog</a>.</em></p> <blockquote> <h2>2.14.0 (2024-03-03)</h2> <ul> <li> <p>Fix <code>utcfromtimestamp()</code> warning on Python 3.12+.</p> <p>Thanks to Konstantin Baikov in <code>PR [#424](adamchainz/time-machine#424) <https://github.com/adamchainz/time-machine/pull/424></code>__.</p> </li> <li> <p>Fix class decorator for classmethod overrides.</p> <p>Thanks to Pavel Bitiukov for the reproducer in <code>PR [#404](adamchainz/time-machine#404) <https://github.com/adamchainz/time-machine/pull/404></code>__.</p> </li> <li> <p>Avoid calling deprecated <code>uuid._load_system_functions()</code> on Python 3.9+.</p> <p>Thanks to Nikita Sobolev for the ping in <code>CPython Issue [#113308](https://github.com/adamchainz/time-machine/issues/113308) <https://github.com/python/cpython/issues/113308></code>__.</p> </li> <li> <p>Support Python 3.13 alpha 4.</p> <p>Thanks to Miro Hrončok in <code>PR [#409](adamchainz/time-machine#409) <https://github.com/adamchainz/time-machine/pull/409></code>__.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/adamchainz/time-machine/commit/8d4c9c078f00f761a676012ad984e01622c7e9ed"><code>8d4c9c0</code></a> Version 2.14.0</li> <li><a href="https://github.com/adamchainz/time-machine/commit/d4881aaa5b658dc138b023762ff151faafbc48ac"><code>d4881aa</code></a> Add Python 3.13 to the CI infrastructure, fix for 3.13.0a2+ (<a href="https://redirect.github.com/adamchainz/time-machine/issues/409">#409</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/3fbd386e6c576ef8edd48b480e3c84a6ef6feb55"><code>3fbd386</code></a> Fix class decorator for classmethod overrides (<a href="https://redirect.github.com/adamchainz/time-machine/issues/404">#404</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/46c66afbea82f163e1281cef55295382ce0c3eda"><code>46c66af</code></a> Fix utcfromtimestamp() deprecation warning (<a href="https://redirect.github.com/adamchainz/time-machine/issues/424">#424</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/2eda5ad3013dabaa7b0afe0dcd1f85310073a77d"><code>2eda5ad</code></a> Avoid calling uuid._load_system_functions() on Python 3.9+. (<a href="https://redirect.github.com/adamchainz/time-machine/issues/425">#425</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/4bd96a2ff28e2cf01c201ee9e5f93b498090b606"><code>4bd96a2</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/time-machine/issues/423">#423</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/5f35ec33825005de7bcf2a1918b312d6d97d009d"><code>5f35ec3</code></a> Use isort to sort imports</li> <li><a href="https://github.com/adamchainz/time-machine/commit/21036d16415b9b1cd9feea50db4975af1b295631"><code>21036d1</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/time-machine/issues/422">#422</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/1f3cbfcb0171056b7c92cb01cd131555de1cfa38"><code>1f3cbfc</code></a> Upgrade requirements (<a href="https://redirect.github.com/adamchainz/time-machine/issues/421">#421</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/36901fe51db82d7855ce8c3557c42d22e0519c26"><code>36901fe</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/time-machine/issues/420">#420</a>)</li> <li>Additional commits viewable in <a href="https://github.com/adamchainz/time-machine/compare/2.13.0...2.14.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=time-machine&package-manager=pip&previous-version=2.13.0&new-version=2.14.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
inmantaci
pushed a commit
to inmanta/inmanta-core
that referenced
this pull request
Mar 6, 2024
Bumps [time-machine](https://github.com/adamchainz/time-machine) from 2.13.0 to 2.14.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/adamchainz/time-machine/blob/main/CHANGELOG.rst">time-machine's changelog</a>.</em></p> <blockquote> <h2>2.14.0 (2024-03-03)</h2> <ul> <li> <p>Fix <code>utcfromtimestamp()</code> warning on Python 3.12+.</p> <p>Thanks to Konstantin Baikov in <code>PR [#424](adamchainz/time-machine#424) <https://github.com/adamchainz/time-machine/pull/424></code>__.</p> </li> <li> <p>Fix class decorator for classmethod overrides.</p> <p>Thanks to Pavel Bitiukov for the reproducer in <code>PR [#404](adamchainz/time-machine#404) <https://github.com/adamchainz/time-machine/pull/404></code>__.</p> </li> <li> <p>Avoid calling deprecated <code>uuid._load_system_functions()</code> on Python 3.9+.</p> <p>Thanks to Nikita Sobolev for the ping in <code>CPython Issue [#113308](https://github.com/adamchainz/time-machine/issues/113308) <https://github.com/python/cpython/issues/113308></code>__.</p> </li> <li> <p>Support Python 3.13 alpha 4.</p> <p>Thanks to Miro Hrončok in <code>PR [#409](adamchainz/time-machine#409) <https://github.com/adamchainz/time-machine/pull/409></code>__.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/adamchainz/time-machine/commit/8d4c9c078f00f761a676012ad984e01622c7e9ed"><code>8d4c9c0</code></a> Version 2.14.0</li> <li><a href="https://github.com/adamchainz/time-machine/commit/d4881aaa5b658dc138b023762ff151faafbc48ac"><code>d4881aa</code></a> Add Python 3.13 to the CI infrastructure, fix for 3.13.0a2+ (<a href="https://redirect.github.com/adamchainz/time-machine/issues/409">#409</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/3fbd386e6c576ef8edd48b480e3c84a6ef6feb55"><code>3fbd386</code></a> Fix class decorator for classmethod overrides (<a href="https://redirect.github.com/adamchainz/time-machine/issues/404">#404</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/46c66afbea82f163e1281cef55295382ce0c3eda"><code>46c66af</code></a> Fix utcfromtimestamp() deprecation warning (<a href="https://redirect.github.com/adamchainz/time-machine/issues/424">#424</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/2eda5ad3013dabaa7b0afe0dcd1f85310073a77d"><code>2eda5ad</code></a> Avoid calling uuid._load_system_functions() on Python 3.9+. (<a href="https://redirect.github.com/adamchainz/time-machine/issues/425">#425</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/4bd96a2ff28e2cf01c201ee9e5f93b498090b606"><code>4bd96a2</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/time-machine/issues/423">#423</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/5f35ec33825005de7bcf2a1918b312d6d97d009d"><code>5f35ec3</code></a> Use isort to sort imports</li> <li><a href="https://github.com/adamchainz/time-machine/commit/21036d16415b9b1cd9feea50db4975af1b295631"><code>21036d1</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/time-machine/issues/422">#422</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/1f3cbfcb0171056b7c92cb01cd131555de1cfa38"><code>1f3cbfc</code></a> Upgrade requirements (<a href="https://redirect.github.com/adamchainz/time-machine/issues/421">#421</a>)</li> <li><a href="https://github.com/adamchainz/time-machine/commit/36901fe51db82d7855ce8c3557c42d22e0519c26"><code>36901fe</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/time-machine/issues/420">#420</a>)</li> <li>Additional commits viewable in <a href="https://github.com/adamchainz/time-machine/compare/2.13.0...2.14.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=time-machine&package-manager=pip&previous-version=2.13.0&new-version=2.14.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In python 3.12 the following DeprecationWarning appears:
This commit fixes it and also removes the suppression from
tox.ini