Skip to content

Commit bdd9314

Browse files
authored
TYP: Update timestamps.pyi (#47756)
* TYP: Update timestamps.pyi * make things type check * add back _as_unit * fix flake8 * more improvements
1 parent 6251e0b commit bdd9314

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

pandas/_libs/tslibs/timestamps.pyi

+19-15
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ class Timestamp(datetime):
8585
def fold(self) -> int: ...
8686
@classmethod
8787
def fromtimestamp(
88-
cls: type[_DatetimeT], t: float, tz: _tzinfo | None = ...
88+
cls: type[_DatetimeT], ts: float, tz: _tzinfo | None = ...
8989
) -> _DatetimeT: ...
9090
@classmethod
91-
def utcfromtimestamp(cls: type[_DatetimeT], t: float) -> _DatetimeT: ...
91+
def utcfromtimestamp(cls: type[_DatetimeT], ts: float) -> _DatetimeT: ...
9292
@classmethod
9393
def today(cls: type[_DatetimeT], tz: _tzinfo | str | None = ...) -> _DatetimeT: ...
9494
@classmethod
@@ -118,19 +118,25 @@ class Timestamp(datetime):
118118
def date(self) -> _date: ...
119119
def time(self) -> _time: ...
120120
def timetz(self) -> _time: ...
121-
def replace(
121+
# LSP violation: nanosecond is not present in datetime.datetime.replace
122+
# and has positional args following it
123+
def replace( # type: ignore[override]
122124
self: _DatetimeT,
123-
year: int = ...,
124-
month: int = ...,
125-
day: int = ...,
126-
hour: int = ...,
127-
minute: int = ...,
128-
second: int = ...,
129-
microsecond: int = ...,
130-
tzinfo: _tzinfo | None = ...,
131-
fold: int = ...,
125+
year: int | None = ...,
126+
month: int | None = ...,
127+
day: int | None = ...,
128+
hour: int | None = ...,
129+
minute: int | None = ...,
130+
second: int | None = ...,
131+
microsecond: int | None = ...,
132+
nanosecond: int | None = ...,
133+
tzinfo: _tzinfo | type[object] | None = ...,
134+
fold: int | None = ...,
135+
) -> _DatetimeT: ...
136+
# LSP violation: datetime.datetime.astimezone has a default value for tz
137+
def astimezone( # type: ignore[override]
138+
self: _DatetimeT, tz: _tzinfo | None
132139
) -> _DatetimeT: ...
133-
def astimezone(self: _DatetimeT, tz: _tzinfo | None = ...) -> _DatetimeT: ...
134140
def ctime(self) -> str: ...
135141
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
136142
@classmethod
@@ -206,8 +212,6 @@ class Timestamp(datetime):
206212
@property
207213
def dayofweek(self) -> int: ...
208214
@property
209-
def day_of_month(self) -> int: ...
210-
@property
211215
def day_of_year(self) -> int: ...
212216
@property
213217
def dayofyear(self) -> int: ...

0 commit comments

Comments
 (0)