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

STY: Assorted refurb suggestions #831

Merged
merged 3 commits into from
Oct 24, 2023
Merged

Conversation

DimitriPapadopoulos
Copy link
Contributor

  • remove no-ops (return at end of function and x = x)
  • use list comprehensions
  • utcnow()now(tz=timezone.utc)
    From https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow:

    Warning: Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling datetime.now(timezone.utc).

    Deprecated since version 3.12: Use datetime.now() with UTC instead.

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (24cfcfa) 63.08% compared to head (1ab45f0) 63.08%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #831   +/-   ##
=======================================
  Coverage   63.08%   63.08%           
=======================================
  Files          53       53           
  Lines        6252     6247    -5     
  Branches      913      913           
=======================================
- Hits         3944     3941    -3     
+ Misses       2121     2119    -2     
  Partials      187      187           
Flag Coverage Δ
reportlettests ?
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
niworkflows/viz/utils.py 77.68% <100.00%> (+0.24%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

niworkflows/viz/utils.py Outdated Show resolved Hide resolved
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Because naive datetime objects are treated by many datetime methods as local
times, it is preferred to use aware datetimes to represent times in UTC.
As such, the recommended way to create an object representing the current
time in UTC is by calling datetime.now(timezone.utc).

Deprecated since version 3.12: Use datetime.now() with UTC instead.

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
@effigies effigies changed the title Assorted refurb suggestions STY: Assorted refurb suggestions Oct 24, 2023
@effigies effigies merged commit 16ccaa9 into nipreps:master Oct 24, 2023
21 checks passed
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