@@ -6,7 +6,6 @@ construction requirements, we need to do object instantiation in python
6
6
(see Timestamp class below). This will serve as a C extension type that
7
7
shadows the python class, where we do any heavy lifting.
8
8
"""
9
- import inspect
10
9
import warnings
11
10
12
11
cimport cython
@@ -257,7 +256,7 @@ cdef class _Timestamp(ABCTimestamp):
257
256
warnings.warn(
258
257
" Timestamp.freq is deprecated and will be removed in a future version." ,
259
258
FutureWarning ,
260
- stacklevel = find_stack_level(inspect.currentframe() ),
259
+ stacklevel = find_stack_level(),
261
260
)
262
261
return self ._freq
263
262
@@ -369,7 +368,7 @@ cdef class _Timestamp(ABCTimestamp):
369
368
" In a future version these will be considered non-comparable. "
370
369
" Use 'ts == pd.Timestamp(date)' or 'ts.date() == date' instead." ,
371
370
FutureWarning ,
372
- stacklevel = find_stack_level(inspect.currentframe() ),
371
+ stacklevel = find_stack_level(),
373
372
)
374
373
return NotImplemented
375
374
else :
@@ -670,7 +669,7 @@ cdef class _Timestamp(ABCTimestamp):
670
669
" version. When you have a freq, use "
671
670
f" freq.{field}(timestamp) instead." ,
672
671
FutureWarning ,
673
- stacklevel = find_stack_level(inspect.currentframe() ),
672
+ stacklevel = find_stack_level(),
674
673
)
675
674
676
675
@property
@@ -1176,7 +1175,7 @@ cdef class _Timestamp(ABCTimestamp):
1176
1175
"""
1177
1176
if self .nanosecond != 0 and warn:
1178
1177
warnings.warn(" Discarding nonzero nanoseconds in conversion." ,
1179
- UserWarning , stacklevel = find_stack_level(inspect.currentframe() ))
1178
+ UserWarning , stacklevel = find_stack_level())
1180
1179
1181
1180
return datetime(self .year, self .month, self .day,
1182
1181
self .hour, self .minute, self .second,
@@ -1255,7 +1254,7 @@ cdef class _Timestamp(ABCTimestamp):
1255
1254
warnings.warn(
1256
1255
" Converting to Period representation will drop timezone information." ,
1257
1256
UserWarning ,
1258
- stacklevel = find_stack_level(inspect.currentframe() ),
1257
+ stacklevel = find_stack_level(),
1259
1258
)
1260
1259
1261
1260
if freq is None :
@@ -1264,7 +1263,7 @@ cdef class _Timestamp(ABCTimestamp):
1264
1263
" In a future version, calling 'Timestamp.to_period()' without "
1265
1264
" passing a 'freq' will raise an exception." ,
1266
1265
FutureWarning ,
1267
- stacklevel = find_stack_level(inspect.currentframe() ),
1266
+ stacklevel = find_stack_level(),
1268
1267
)
1269
1268
1270
1269
return Period(self , freq = freq)
@@ -1456,7 +1455,7 @@ class Timestamp(_Timestamp):
1456
1455
" Timestamp.utcfromtimestamp(ts).tz_localize(None). "
1457
1456
" To get the future behavior, use Timestamp.fromtimestamp(ts, 'UTC')" ,
1458
1457
FutureWarning ,
1459
- stacklevel = find_stack_level(inspect.currentframe() ),
1458
+ stacklevel = find_stack_level(),
1460
1459
)
1461
1460
return cls (datetime.utcfromtimestamp(ts))
1462
1461
@@ -1692,7 +1691,7 @@ class Timestamp(_Timestamp):
1692
1691
" as a wall time, not a UTC time. To interpret as a UTC time, "
1693
1692
" use `Timestamp(dt64).tz_localize('UTC').tz_convert(tz)`" ,
1694
1693
FutureWarning ,
1695
- stacklevel = find_stack_level(inspect.currentframe() ),
1694
+ stacklevel = find_stack_level(),
1696
1695
)
1697
1696
# Once this deprecation is enforced, we can do
1698
1697
# return Timestamp(ts_input).tz_localize(tzobj)
@@ -1709,7 +1708,7 @@ class Timestamp(_Timestamp):
1709
1708
" The 'freq' argument in Timestamp is deprecated and will be "
1710
1709
" removed in a future version." ,
1711
1710
FutureWarning ,
1712
- stacklevel = find_stack_level(inspect.currentframe() ),
1711
+ stacklevel = find_stack_level(),
1713
1712
)
1714
1713
if not is_offset_object(freq):
1715
1714
freq = to_offset(freq)
@@ -2045,7 +2044,7 @@ timedelta}, default 'raise'
2045
2044
warnings.warn(
2046
2045
" Timestamp.freqstr is deprecated and will be removed in a future version." ,
2047
2046
FutureWarning ,
2048
- stacklevel = find_stack_level(inspect.currentframe() ),
2047
+ stacklevel = find_stack_level(),
2049
2048
)
2050
2049
return self ._freqstr
2051
2050
0 commit comments