Skip to content

Commit aa71f32

Browse files
AmirAmir
authored andcommitted
Modified top-level name object for all cython Type classes
1 parent 2da62af commit aa71f32

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

pandas/_libs/interval.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ from pandas._libs.tslibs.util cimport (
4141
is_integer_object,
4242
)
4343

44+
from pandas.util._decorators import set_module
45+
4446
VALID_CLOSED = frozenset(["left", "right", "both", "neither"])
4547

4648

pandas/_libs/tslibs/period.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ from pandas._libs.tslibs.offsets import (
115115
BDay,
116116
)
117117

118+
from pandas.util._decorators import set_module
119+
118120
cdef:
119121
enum:
120122
INT32_MIN = -2_147_483_648LL
@@ -2830,6 +2832,7 @@ cdef class _Period(PeriodMixin):
28302832
return period_format(self.ordinal, base, fmt)
28312833

28322834

2835+
@set_module("pandas")
28332836
class Period(_Period):
28342837
"""
28352838
Represents a period of time.

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import collections
22
import warnings
33

44
from pandas.util._exceptions import find_stack_level
5+
from pandas.util._decorators import set_module
56

67
cimport cython
78
from cpython.object cimport (
@@ -1852,6 +1853,7 @@ cdef class _Timedelta(timedelta):
18521853
# Python front end to C extension type _Timedelta
18531854
# This serves as the box for timedelta64
18541855

1856+
@set_module("pandas")
18551857
class Timedelta(_Timedelta):
18561858
"""
18571859
Represents a duration, the difference between two dates or times.

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ from pandas._libs.tslibs cimport ccalendar
5151
from pandas._libs.tslibs.base cimport ABCTimestamp
5252

5353
from pandas.util._exceptions import find_stack_level
54+
from pandas.util._decorators import set_module
5455

5556
from pandas._libs.tslibs.conversion cimport (
5657
_TSObject,
@@ -1648,7 +1649,7 @@ cdef class _Timestamp(ABCTimestamp):
16481649
# Python front end to C extension type _Timestamp
16491650
# This serves as the box for datetime64
16501651
1651-
1652+
@set_module("pandas")
16521653
class Timestamp(_Timestamp):
16531654
"""
16541655
Pandas replacement for python datetime.datetime object.

pandas/tests/api/test_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,7 @@ def test_set_module():
413413
assert pd.PeriodIndex.__module__ == "pandas"
414414
assert pd.RangeIndex.__module__ == "pandas"
415415
assert pd.TimedeltaIndex.__module__ == "pandas"
416+
assert pd.Timestamp.__module__ == "pandas"
417+
assert pd.Timedelta.__module__ == "pandas"
418+
assert pd.Period.__module__ == "pandas"
419+

0 commit comments

Comments
 (0)