Skip to content

Commit 102e9a3

Browse files
Enable ruff DTZ001 rule (#11326)
* updating DIRECTORY.md * Enable ruff DTZ001 rule * Fix other/gauss_easter.py * Fix * Fix * Fix * Fix * Fix * Fix --------- Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
1 parent 481c071 commit 102e9a3

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

DIRECTORY.md

+2
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@
419419
* [Koch Snowflake](fractals/koch_snowflake.py)
420420
* [Mandelbrot](fractals/mandelbrot.py)
421421
* [Sierpinski Triangle](fractals/sierpinski_triangle.py)
422+
* [Vicsek](fractals/vicsek.py)
422423

423424
## Fuzzy Logic
424425
* [Fuzzy Operations](fuzzy_logic/fuzzy_operations.py)
@@ -678,6 +679,7 @@
678679
* [Newton Forward Interpolation](maths/numerical_analysis/newton_forward_interpolation.py)
679680
* [Newton Raphson](maths/numerical_analysis/newton_raphson.py)
680681
* [Numerical Integration](maths/numerical_analysis/numerical_integration.py)
682+
* [Proper Fractions](maths/numerical_analysis/proper_fractions.py)
681683
* [Runge Kutta](maths/numerical_analysis/runge_kutta.py)
682684
* [Runge Kutta Fehlberg 45](maths/numerical_analysis/runge_kutta_fehlberg_45.py)
683685
* [Runge Kutta Gills](maths/numerical_analysis/runge_kutta_gills.py)

other/gauss_easter.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
"""
44

55
import math
6-
from datetime import datetime, timedelta
6+
from datetime import UTC, datetime, timedelta
77

88

99
def gauss_easter(year: int) -> datetime:
1010
"""
1111
Calculation Gregorian easter date for given year
1212
1313
>>> gauss_easter(2007)
14-
datetime.datetime(2007, 4, 8, 0, 0)
14+
datetime.datetime(2007, 4, 8, 0, 0, tzinfo=datetime.timezone.utc)
1515
1616
>>> gauss_easter(2008)
17-
datetime.datetime(2008, 3, 23, 0, 0)
17+
datetime.datetime(2008, 3, 23, 0, 0, tzinfo=datetime.timezone.utc)
1818
1919
>>> gauss_easter(2020)
20-
datetime.datetime(2020, 4, 12, 0, 0)
20+
datetime.datetime(2020, 4, 12, 0, 0, tzinfo=datetime.timezone.utc)
2121
2222
>>> gauss_easter(2021)
23-
datetime.datetime(2021, 4, 4, 0, 0)
23+
datetime.datetime(2021, 4, 4, 0, 0, tzinfo=datetime.timezone.utc)
2424
"""
2525
metonic_cycle = year % 19
2626
julian_leap_year = year % 4
@@ -45,11 +45,11 @@ def gauss_easter(year: int) -> datetime:
4545
) % 7
4646

4747
if days_to_add == 29 and days_from_phm_to_sunday == 6:
48-
return datetime(year, 4, 19)
48+
return datetime(year, 4, 19, tzinfo=UTC)
4949
elif days_to_add == 28 and days_from_phm_to_sunday == 6:
50-
return datetime(year, 4, 18)
50+
return datetime(year, 4, 18, tzinfo=UTC)
5151
else:
52-
return datetime(year, 3, 22) + timedelta(
52+
return datetime(year, 3, 22, tzinfo=UTC) + timedelta(
5353
days=int(days_to_add + days_from_phm_to_sunday)
5454
)
5555

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
lint.ignore = [ # `ruff rule S101` for a description of that rule
33
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
44
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
5-
"DTZ001", # The use of `datetime.datetime()` without `tzinfo` argument is not allowed -- FIX ME
65
"DTZ005", # The use of `datetime.datetime.now()` without `tzinfo` argument is not allowed -- FIX ME
76
"E741", # Ambiguous variable name 'l' -- FIX ME
87
"EM101", # Exception must not use a string literal, assign to variable first

0 commit comments

Comments
 (0)