File tree 5 files changed +12
-5
lines changed
5 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ from pandas._libs.tslibs.offsets import (
114
114
INVALID_FREQ_ERR_MSG,
115
115
BDay,
116
116
)
117
+ from pandas.util._decorators import set_module
117
118
118
119
cdef:
119
120
enum :
@@ -2830,6 +2831,7 @@ cdef class _Period(PeriodMixin):
2830
2831
return period_format(self.ordinal , base , fmt )
2831
2832
2832
2833
2834
+ @set_module("pandas")
2833
2835
class Period(_Period ):
2834
2836
"""
2835
2837
Represents a period of time.
Original file line number Diff line number Diff line change 1
1
import collections
2
2
import warnings
3
3
4
+ from pandas.util._decorators import set_module
4
5
from pandas.util._exceptions import find_stack_level
5
6
6
7
cimport cython
@@ -1854,7 +1855,7 @@ cdef class _Timedelta(timedelta):
1854
1855
1855
1856
# Python front end to C extension type _Timedelta
1856
1857
# This serves as the box for timedelta64
1857
-
1858
+ @ set_module ( " pandas " )
1858
1859
class Timedelta (_Timedelta ):
1859
1860
"""
1860
1861
Represents a duration, the difference between two dates or times.
@@ -1916,7 +1917,7 @@ class Timedelta(_Timedelta):
1916
1917
--------
1917
1918
Here we initialize Timedelta object with both value and unit
1918
1919
1919
- >>> td = pd.Timedelta(1, "d ")
1920
+ >>> td = pd.Timedelta(1, "D ")
1920
1921
>>> td
1921
1922
Timedelta('1 days 00:00:00')
1922
1923
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ import datetime as dt
50
50
from pandas._libs.tslibs cimport ccalendar
51
51
from pandas._libs.tslibs.base cimport ABCTimestamp
52
52
53
+ from pandas.util._decorators import set_module
53
54
from pandas.util._exceptions import find_stack_level
54
55
55
56
from pandas._libs.tslibs.conversion cimport (
@@ -1648,7 +1649,7 @@ cdef class _Timestamp(ABCTimestamp):
1648
1649
# Python front end to C extension type _Timestamp
1649
1650
# This serves as the box for datetime64
1650
1651
1651
-
1652
+ @set_module("pandas")
1652
1653
class Timestamp(_Timestamp):
1653
1654
"""
1654
1655
Pandas replacement for python datetime.datetime object .
@@ -2926,7 +2927,7 @@ timedelta}, default 'raise'
2926
2927
--------
2927
2928
>>> ts = pd.Timestamp(1584226800 , unit = ' s' , tz = ' Europe/Stockholm' )
2928
2929
>>> ts.tz
2929
- < DstTzInfo ' Europe/Stockholm' CET + 1 : 00 : 00 STD >
2930
+ zoneinfo.ZoneInfo( key = ' Europe/Stockholm' )
2930
2931
"""
2931
2932
return self.tzinfo
2932
2933
Original file line number Diff line number Diff line change @@ -400,3 +400,6 @@ def test_util_in_top_level(self):
400
400
401
401
def test_set_module ():
402
402
assert pd .DataFrame .__module__ == "pandas"
403
+ assert pd .Period .__module__ == "pandas"
404
+ assert pd .Timestamp .__module__ == "pandas"
405
+ assert pd .Timedelta .__module__ == "pandas"
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def test_maybe_get_tz_invalid_types():
144
144
with pytest .raises (TypeError , match = "<class 'module'>" ):
145
145
timezones .maybe_get_tz (pytest )
146
146
147
- msg = "<class 'pandas._libs.tslibs.timestamps. Timestamp'>"
147
+ msg = "<class 'pandas.Timestamp'>"
148
148
with pytest .raises (TypeError , match = msg ):
149
149
timezones .maybe_get_tz (Timestamp ("2021-01-01" , tz = "UTC" ))
150
150
You can’t perform that action at this time.
0 commit comments