Skip to content

Enable ruff DTZ001 rule #11326

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

Merged
merged 9 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@
* [Koch Snowflake](fractals/koch_snowflake.py)
* [Mandelbrot](fractals/mandelbrot.py)
* [Sierpinski Triangle](fractals/sierpinski_triangle.py)
* [Vicsek](fractals/vicsek.py)

## Fuzzy Logic
* [Fuzzy Operations](fuzzy_logic/fuzzy_operations.py)
Expand Down Expand Up @@ -678,6 +679,7 @@
* [Newton Forward Interpolation](maths/numerical_analysis/newton_forward_interpolation.py)
* [Newton Raphson](maths/numerical_analysis/newton_raphson.py)
* [Numerical Integration](maths/numerical_analysis/numerical_integration.py)
* [Proper Fractions](maths/numerical_analysis/proper_fractions.py)
* [Runge Kutta](maths/numerical_analysis/runge_kutta.py)
* [Runge Kutta Fehlberg 45](maths/numerical_analysis/runge_kutta_fehlberg_45.py)
* [Runge Kutta Gills](maths/numerical_analysis/runge_kutta_gills.py)
Expand Down
16 changes: 8 additions & 8 deletions other/gauss_easter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
"""

import math
from datetime import datetime, timedelta
from datetime import UTC, datetime, timedelta


def gauss_easter(year: int) -> datetime:
"""
Calculation Gregorian easter date for given year

>>> gauss_easter(2007)
datetime.datetime(2007, 4, 8, 0, 0)
datetime.datetime(2007, 4, 8, 0, 0, tzinfo=datetime.timezone.utc)

>>> gauss_easter(2008)
datetime.datetime(2008, 3, 23, 0, 0)
datetime.datetime(2008, 3, 23, 0, 0, tzinfo=datetime.timezone.utc)

>>> gauss_easter(2020)
datetime.datetime(2020, 4, 12, 0, 0)
datetime.datetime(2020, 4, 12, 0, 0, tzinfo=datetime.timezone.utc)

>>> gauss_easter(2021)
datetime.datetime(2021, 4, 4, 0, 0)
datetime.datetime(2021, 4, 4, 0, 0, tzinfo=datetime.timezone.utc)
"""
metonic_cycle = year % 19
julian_leap_year = year % 4
Expand All @@ -45,11 +45,11 @@ def gauss_easter(year: int) -> datetime:
) % 7

if days_to_add == 29 and days_from_phm_to_sunday == 6:
return datetime(year, 4, 19)
return datetime(year, 4, 19, tzinfo=UTC)
elif days_to_add == 28 and days_from_phm_to_sunday == 6:
return datetime(year, 4, 18)
return datetime(year, 4, 18, tzinfo=UTC)
else:
return datetime(year, 3, 22) + timedelta(
return datetime(year, 3, 22, tzinfo=UTC) + timedelta(
days=int(days_to_add + days_from_phm_to_sunday)
)

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lint.ignore = [ # `ruff rule S101` for a description of that rule
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
"DTZ001", # The use of `datetime.datetime()` without `tzinfo` argument is not allowed -- FIX ME
"DTZ005", # The use of `datetime.datetime.now()` without `tzinfo` argument is not allowed -- FIX ME
"E741", # Ambiguous variable name 'l' -- FIX ME
"EM101", # Exception must not use a string literal, assign to variable first
Expand Down