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>
This commit is contained in:
Maxim Smolskiy 2024-03-25 10:43:24 +03:00 committed by GitHub
parent 481c071e84
commit 102e9a31b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 9 deletions

View File

@ -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)
@ -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)

View File

@ -3,7 +3,7 @@ https://en.wikipedia.org/wiki/Computus#Gauss'_Easter_algorithm
"""
import math
from datetime import datetime, timedelta
from datetime import UTC, datetime, timedelta
def gauss_easter(year: int) -> datetime:
@ -11,16 +11,16 @@ 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
@ -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)
)

View File

@ -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