mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 12:01:52 +08:00
Use PEP 585 syntax in @python2/_ast, convert more TypeVars to _typeshed.Self, & # noqa a SQLAlchemy line (#6954)
* Manual fixes for `_ast` and `SQLAlchemy` * Change more `TypeVar`s to `Self`, using script
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from time import struct_time
|
||||
from typing import AnyStr, ClassVar, SupportsAbs, TypeVar, Union, overload
|
||||
|
||||
_S = TypeVar("_S")
|
||||
from typing import AnyStr, ClassVar, SupportsAbs, Union, overload
|
||||
|
||||
_Text = Union[str, unicode]
|
||||
|
||||
@@ -20,13 +19,13 @@ class date:
|
||||
min: ClassVar[date]
|
||||
max: ClassVar[date]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(cls: type[_S], year: int, month: int, day: int) -> _S: ...
|
||||
def __new__(cls: type[Self], year: int, month: int, day: int) -> Self: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls: type[_S], __timestamp: float) -> _S: ...
|
||||
def fromtimestamp(cls: type[Self], __timestamp: float) -> Self: ...
|
||||
@classmethod
|
||||
def today(cls: type[_S]) -> _S: ...
|
||||
def today(cls: type[Self]) -> Self: ...
|
||||
@classmethod
|
||||
def fromordinal(cls: type[_S], n: int) -> _S: ...
|
||||
def fromordinal(cls: type[Self], n: int) -> Self: ...
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@property
|
||||
@@ -60,8 +59,13 @@ class time:
|
||||
max: ClassVar[time]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: type[_S], hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: _tzinfo | None = ...
|
||||
) -> _S: ...
|
||||
cls: type[Self],
|
||||
hour: int = ...,
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
) -> Self: ...
|
||||
@property
|
||||
def hour(self) -> int: ...
|
||||
@property
|
||||
@@ -95,7 +99,7 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
max: ClassVar[timedelta]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: type[_S],
|
||||
cls: type[Self],
|
||||
days: float = ...,
|
||||
seconds: float = ...,
|
||||
microseconds: float = ...,
|
||||
@@ -103,7 +107,7 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
minutes: float = ...,
|
||||
hours: float = ...,
|
||||
weeks: float = ...,
|
||||
) -> _S: ...
|
||||
) -> Self: ...
|
||||
@property
|
||||
def days(self) -> int: ...
|
||||
@property
|
||||
@@ -139,7 +143,7 @@ class datetime(date):
|
||||
max: ClassVar[datetime]
|
||||
resolution: ClassVar[timedelta]
|
||||
def __new__(
|
||||
cls: type[_S],
|
||||
cls: type[Self],
|
||||
year: int,
|
||||
month: int,
|
||||
day: int,
|
||||
@@ -148,7 +152,7 @@ class datetime(date):
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
) -> _S: ...
|
||||
) -> Self: ...
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@property
|
||||
@@ -166,21 +170,21 @@ class datetime(date):
|
||||
@property
|
||||
def tzinfo(self) -> _tzinfo | None: ...
|
||||
@classmethod
|
||||
def fromtimestamp(cls: type[_S], t: float, tz: _tzinfo | None = ...) -> _S: ...
|
||||
def fromtimestamp(cls: type[Self], t: float, tz: _tzinfo | None = ...) -> Self: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls: type[_S], t: float) -> _S: ...
|
||||
def utcfromtimestamp(cls: type[Self], t: float) -> Self: ...
|
||||
@classmethod
|
||||
def today(cls: type[_S]) -> _S: ...
|
||||
def today(cls: type[Self]) -> Self: ...
|
||||
@classmethod
|
||||
def fromordinal(cls: type[_S], n: int) -> _S: ...
|
||||
def fromordinal(cls: type[Self], n: int) -> Self: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls: type[_S], tz: None = ...) -> _S: ...
|
||||
def now(cls: type[Self], tz: None = ...) -> Self: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls, tz: _tzinfo) -> datetime: ...
|
||||
@classmethod
|
||||
def utcnow(cls: type[_S]) -> _S: ...
|
||||
def utcnow(cls: type[Self]) -> Self: ...
|
||||
@classmethod
|
||||
def combine(cls, date: _date, time: _time) -> datetime: ...
|
||||
def strftime(self, fmt: _Text) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user