Skip to content

Commit d44d0f7

Browse files
committed
precommit cleanup
1 parent e41ac9f commit d44d0f7

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

pandas/_libs/tslibs/ccalendar.pyx

+15-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"""
33
Cython implementations of functions resembling the stdlib calendar module
44
"""
5-
from libc.stdlib cimport abs as c_abs
65
cimport cython
76
from numpy cimport (
87
int32_t,
@@ -19,8 +18,7 @@ cdef int32_t* days_per_month_array = [
1918
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
2019
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
2120

22-
cdef int* sakamoto_arr = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
23-
cdef int* em = [0 ,0 ,31 ,59 ,90 ,120 ,151 ,181 ,212 ,243 ,273 ,304 ,334]
21+
cdef int* em = [0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
2422

2523
# The first 13 entries give the month days elapsed as of the first of month N
2624
# (or the total number of days in the year for N=13) in non-leap years.
@@ -74,16 +72,18 @@ cpdef int32_t get_days_in_month(int year, Py_ssize_t month) noexcept nogil:
7472
"""
7573
return days_per_month_array[12 * is_leapyear(year) + month - 1]
7674

75+
7776
@cython.wraparound(False)
7877
@cython.boundscheck(False)
7978
@cython.cdivision(True)
8079
cdef long quot(long a , long b) noexcept nogil:
8180
cdef long x
82-
x = a/b
83-
if ( a < 0 ):
84-
x -= ( a % b != 0 )
81+
x = a/b
82+
if (a < 0):
83+
x -= (a % b != 0)
8584
return x
8685

86+
8787
@cython.wraparound(False)
8888
@cython.boundscheck(False)
8989
@cython.cdivision(True)
@@ -115,23 +115,22 @@ cdef int dayofweek(int y, int m, int d) noexcept nogil:
115115
[2] https://en.wikipedia.org/wiki/\
116116
Determination_of_the_day_of_the_week#Gauss's_algorithm
117117
"""
118-
119-
cdef:
120-
long c
118+
cdef:
119+
long c
121120
int g
122121
int f
123122
int e
124-
123+
125124
if (m < 3):
126125
y -= 1
127-
128-
c = quot(y, 100)
129-
g = y - quot(y, 100) * 100
126+
127+
c = quot(y, 100)
128+
g = y - quot(y, 100) * 100
130129
f = 5 * (c - quot(c, 4) * 4)
131-
e = em[m]
132-
130+
e = em[m]
131+
133132
if (m > 2):
134-
e -= 1;
133+
e -= 1
135134
return (-1 + d + e + f + g + g/4) % 7
136135

137136
cdef bint is_leapyear(int64_t year) noexcept nogil:

0 commit comments

Comments
 (0)