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

Get rid of Python warning about use of deprecated function #93

Merged
merged 7 commits into from
Nov 28, 2023

Conversation

jsf9k
Copy link
Member

@jsf9k jsf9k commented Nov 27, 2023

🗣 Description

This pull request gets rid of a warning about the use of a deprecated function in the Python datetime library.

💭 Motivation and context

Resolves #88.

🧪 Testing

All automated tests pass. I also built a new Docker image with these changes and verified that it functions as expected.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All new and existing tests pass.
  • Build and test a Docker image containing these changes.

✅ Pre-merge checklist

  • Finalize version.

✅ Post-merge checklist

  • Create a release.

datetime.now(datetime.UTC) is the preferred way to do the same thing.

Resolves #88.
The previous version incorrectly triggers on some Python strings
containing colons so we need the updated hook here; otherwise, we get
errors that look like:
src/report/generate_https_scan_report.py:772:38: E231 missing whitespace after ':'
src/report/graphs.py:186:39: E231 missing whitespace after ':'
src/report/graphs.py:186:40: E231 missing whitespace after ','
src/report/graphs.py:586:77: E231 missing whitespace after ':'
src/report/graphs.py:589:47: E231 missing whitespace after ':'
src/report/graphs.py:640:74: E231 missing whitespace after ':'
src/report/graphs.py:641:66: E231 missing whitespace after ':'
@jsf9k jsf9k added improvement This issue or pull request will add or improve functionality, maintainability, or ease of use version bump This issue or pull request increments the version number python Pull requests that update Python code labels Nov 27, 2023
@jsf9k jsf9k self-assigned this Nov 27, 2023
datetime.UTC is an alias for datetime.timezone.utc, but it is only
available as of version 3.11 of Python.  For more information see:
https://docs.python.org/3/library/datetime.html#datetime.UTC
@jsf9k jsf9k marked this pull request as ready for review November 27, 2023 18:04
@jsf9k jsf9k requested review from felddy and dv4harr10 November 27, 2023 18:04
@jsf9k jsf9k mentioned this pull request Nov 27, 2023
10 tasks
Copy link
Member

@dav3r dav3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for keeping us current 👍

@jsf9k jsf9k enabled auto-merge November 28, 2023 18:46
@jsf9k jsf9k merged commit 2a79d9e into develop Nov 28, 2023
13 checks passed
@jsf9k jsf9k deleted the improvement/get-rid-of-python-warning branch November 28, 2023 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement This issue or pull request will add or improve functionality, maintainability, or ease of use python Pull requests that update Python code version bump This issue or pull request increments the version number
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

Get rid of datetime.datetime.utcnow() deprecation warning
3 participants