@@ -9,7 +9,6 @@ import sys
9
9
from time import struct_time
10
10
from typing import (
11
11
ClassVar ,
12
- Optional ,
13
12
Type ,
14
13
TypeVar ,
15
14
overload ,
@@ -27,10 +26,8 @@ from pandas._libs.tslibs import (
27
26
28
27
_S = TypeVar ("_S" )
29
28
30
-
31
29
def integer_op_not_supported (obj ) -> None : ...
32
30
33
-
34
31
class Timestamp (datetime ):
35
32
min : ClassVar [Timestamp ]
36
33
max : ClassVar [Timestamp ]
@@ -41,9 +38,15 @@ class Timestamp(datetime):
41
38
# error: "__new__" must return a class instance (got "Union[Timestamp, NaTType]")
42
39
def __new__ ( # type: ignore[misc]
43
40
cls : Type [_S ],
44
- ts_input : int | np .integer | float | str | _date | datetime | np .datetime64 = ...,
41
+ ts_input : int
42
+ | np .integer
43
+ | float
44
+ | str
45
+ | _date
46
+ | datetime
47
+ | np .datetime64 = ...,
45
48
freq = ...,
46
- tz : str | _tzinfo | None | int = ...,
49
+ tz : str | _tzinfo | None | int = ...,
47
50
unit = ...,
48
51
year : int | None = ...,
49
52
month : int | None = ...,
@@ -55,7 +58,7 @@ class Timestamp(datetime):
55
58
nanosecond : int | None = ...,
56
59
tzinfo : _tzinfo | None = ...,
57
60
* ,
58
- fold : int | None = ...,
61
+ fold : int | None = ...,
59
62
) -> _S | NaTType : ...
60
63
61
64
def _set_freq (self , freq : BaseOffset | None ) -> None : ...
@@ -75,22 +78,19 @@ class Timestamp(datetime):
75
78
@property
76
79
def microsecond (self ) -> int : ...
77
80
@property
78
- def tzinfo (self ) -> Optional [ _tzinfo ] : ...
81
+ def tzinfo (self ) -> _tzinfo | None : ...
79
82
@property
80
- def tz (self ) -> Optional [_tzinfo ]: ...
81
-
83
+ def tz (self ) -> _tzinfo | None : ...
82
84
@property
83
85
def fold (self ) -> int : ...
84
-
85
86
@classmethod
86
- def fromtimestamp (cls : Type [_S ], t : float , tz : Optional [ _tzinfo ] = ...) -> _S : ...
87
+ def fromtimestamp (cls : Type [_S ], t : float , tz : _tzinfo | None = ...) -> _S : ...
87
88
@classmethod
88
89
def utcfromtimestamp (cls : Type [_S ], t : float ) -> _S : ...
89
90
@classmethod
90
91
def today (cls : Type [_S ]) -> _S : ...
91
92
@classmethod
92
93
def fromordinal (cls : Type [_S ], n : int ) -> _S : ...
93
-
94
94
if sys .version_info >= (3 , 8 ):
95
95
@classmethod
96
96
def now (cls : Type [_S ], tz : _tzinfo | str | None = ...) -> _S : ...
@@ -101,28 +101,23 @@ class Timestamp(datetime):
101
101
@overload
102
102
@classmethod
103
103
def now (cls , tz : _tzinfo ) -> datetime : ...
104
-
105
104
@classmethod
106
105
def utcnow (cls : Type [_S ]) -> _S : ...
107
106
@classmethod
108
- def combine (cls , date : _date , time : _time , tzinfo : Optional [_tzinfo ] = ...) -> datetime : ...
109
-
107
+ def combine (
108
+ cls , date : _date , time : _time , tzinfo : _tzinfo | None = ...
109
+ ) -> datetime : ...
110
110
@classmethod
111
111
def fromisoformat (cls : Type [_S ], date_string : str ) -> _S : ...
112
-
113
112
def strftime (self , fmt : str ) -> str : ...
114
113
def __format__ (self , fmt : str ) -> str : ...
115
-
116
114
def toordinal (self ) -> int : ...
117
115
def timetuple (self ) -> struct_time : ...
118
-
119
116
def timestamp (self ) -> float : ...
120
-
121
117
def utctimetuple (self ) -> struct_time : ...
122
118
def date (self ) -> _date : ...
123
119
def time (self ) -> _time : ...
124
120
def timetz (self ) -> _time : ...
125
-
126
121
def replace (
127
122
self ,
128
123
year : int = ...,
@@ -132,26 +127,21 @@ class Timestamp(datetime):
132
127
minute : int = ...,
133
128
second : int = ...,
134
129
microsecond : int = ...,
135
- tzinfo : Optional [ _tzinfo ] = ...,
130
+ tzinfo : _tzinfo | None = ...,
136
131
* ,
137
132
fold : int = ...,
138
133
) -> datetime : ...
139
-
140
134
if sys .version_info >= (3 , 8 ):
141
- def astimezone (self : _S , tz : Optional [ _tzinfo ] = ...) -> _S : ...
135
+ def astimezone (self : _S , tz : _tzinfo | None = ...) -> _S : ...
142
136
else :
143
- def astimezone (self , tz : Optional [_tzinfo ] = ...) -> datetime : ...
144
-
137
+ def astimezone (self , tz : _tzinfo | None = ...) -> datetime : ...
145
138
def ctime (self ) -> str : ...
146
139
def isoformat (self , sep : str = ..., timespec : str = ...) -> str : ...
147
-
148
140
@classmethod
149
141
def strptime (cls , date_string : str , format : str ) -> datetime : ...
150
-
151
- def utcoffset (self ) -> Optional [timedelta ]: ...
152
- def tzname (self ) -> Optional [str ]: ...
153
- def dst (self ) -> Optional [timedelta ]: ...
154
-
142
+ def utcoffset (self ) -> timedelta | None : ...
143
+ def tzname (self ) -> str | None : ...
144
+ def dst (self ) -> timedelta | None : ...
155
145
def __le__ (self , other : datetime ) -> bool : ... # type: ignore
156
146
def __lt__ (self , other : datetime ) -> bool : ... # type: ignore
157
147
def __ge__ (self , other : datetime ) -> bool : ... # type: ignore
@@ -166,12 +156,10 @@ class Timestamp(datetime):
166
156
def __sub__ (self , other : datetime ) -> timedelta : ...
167
157
@overload
168
158
def __sub__ (self , other : timedelta ) -> datetime : ...
169
-
170
159
def __hash__ (self ) -> int : ...
171
160
def weekday (self ) -> int : ...
172
161
def isoweekday (self ) -> int : ...
173
162
def isocalendar (self ) -> tuple [int , int , int ]: ...
174
-
175
163
@property
176
164
def is_leap_year (self ) -> bool : ...
177
165
@property
@@ -186,23 +174,25 @@ class Timestamp(datetime):
186
174
def is_quarter_end (self ) -> bool : ...
187
175
@property
188
176
def is_year_end (self ) -> bool : ...
189
-
190
177
def to_pydatetime (self , warn : bool = ...) -> datetime : ...
191
178
def to_datetime64 (self ) -> np .datetime64 : ...
192
179
def to_period (self , freq ) -> Period : ...
193
180
def to_julian_date (self ) -> np .float64 : ...
194
-
195
181
@property
196
182
def asm8 (self ) -> np .datetime64 : ...
197
-
198
183
def tz_convert (self : _S , tz ) -> _S : ...
199
-
200
184
# TODO: could return NaT?
201
- def tz_localize (self : _S , tz , ambiguous : str = ..., nonexistent : str = ...) -> _S : ...
202
-
185
+ def tz_localize (
186
+ self : _S , tz , ambiguous : str = ..., nonexistent : str = ...
187
+ ) -> _S : ...
203
188
def normalize (self : _S ) -> _S : ...
204
-
205
189
# TODO: round/floor/ceil could return NaT?
206
- def round (self : _S , freq , ambiguous : bool | str = ..., nonexistent : str = ...) -> _S : ...
207
- def floor (self : _S , freq , ambiguous : bool | str = ..., nonexistent : str = ...) -> _S : ...
208
- def ceil (self : _S , freq , ambiguous : bool | str = ..., nonexistent : str = ...) -> _S : ...
190
+ def round (
191
+ self : _S , freq , ambiguous : bool | str = ..., nonexistent : str = ...
192
+ ) -> _S : ...
193
+ def floor (
194
+ self : _S , freq , ambiguous : bool | str = ..., nonexistent : str = ...
195
+ ) -> _S : ...
196
+ def ceil (
197
+ self : _S , freq , ambiguous : bool | str = ..., nonexistent : str = ...
198
+ ) -> _S : ...
0 commit comments