Skip to content

Commit bc655f4

Browse files
committed
Resolve cython typing issue
1 parent 243192a commit bc655f4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pandas/_libs/tslibs/offsets.pyx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ cnp.import_array()
3232

3333
# TODO: formalize having _libs.properties "above" tslibs in the dependency structure
3434

35+
from typing import ClassVar
36+
3537
from pandas._libs.properties import cache_readonly
3638

3739
from pandas._libs.tslibs cimport util
@@ -2524,8 +2526,7 @@ cdef class YearOffset(SingleConstructorOffset):
25242526
"""
25252527
_attributes = tuple(["n", "normalize", "month"])
25262528

2527-
# FIXME(cython#4446): python annotation here gives compile-time errors
2528-
# _default_month: int
2529+
_default_month: ClassVar[int]
25292530

25302531
cdef readonly:
25312532
int month
@@ -2788,9 +2789,8 @@ cdef class QuarterOffset(SingleConstructorOffset):
27882789
# point. Also apply_index, is_on_offset, rule_code if
27892790
# startingMonth vs month attr names are resolved
27902791

2791-
# FIXME(cython#4446): python annotation here gives compile-time errors
2792-
# _default_starting_month: int
2793-
# _from_name_starting_month: int
2792+
_default_starting_month: ClassVar[int]
2793+
_from_name_starting_month: ClassVar[int]
27942794

27952795
cdef readonly:
27962796
int startingMonth
@@ -3018,9 +3018,8 @@ cdef class HalfYearOffset(SingleConstructorOffset):
30183018
_attributes = tuple(["n", "normalize", "startingMonth"])
30193019
# TODO: Consider combining HalfYearOffset, QuarterOffset and YearOffset
30203020

3021-
# FIXME(cython#4446): python annotation here gives compile-time errors
3022-
# _default_starting_month: int
3023-
# _from_name_starting_month: int
3021+
_default_starting_month: ClassVar[int]
3022+
_from_name_starting_month: ClassVar[int]
30243023

30253024
cdef readonly:
30263025
int startingMonth

0 commit comments

Comments
 (0)