mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
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:
parent
481c071e84
commit
102e9a31b6
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user