mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
stdlib: enforce CamelCase for type alias names (#8255)
This commit is contained in:
@@ -7,7 +7,7 @@ if sys.version_info >= (3, 8):
|
||||
PyCF_TYPE_COMMENTS: Literal[4096]
|
||||
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
|
||||
|
||||
_identifier: TypeAlias = str
|
||||
_Identifier: TypeAlias = str
|
||||
|
||||
class AST:
|
||||
if sys.version_info >= (3, 10):
|
||||
@@ -61,7 +61,7 @@ class stmt(AST): ...
|
||||
class FunctionDef(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
|
||||
name: _identifier
|
||||
name: _Identifier
|
||||
args: arguments
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
@@ -70,7 +70,7 @@ class FunctionDef(stmt):
|
||||
class AsyncFunctionDef(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
|
||||
name: _identifier
|
||||
name: _Identifier
|
||||
args: arguments
|
||||
body: list[stmt]
|
||||
decorator_list: list[expr]
|
||||
@@ -79,7 +79,7 @@ class AsyncFunctionDef(stmt):
|
||||
class ClassDef(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("name", "bases", "keywords", "body", "decorator_list")
|
||||
name: _identifier
|
||||
name: _Identifier
|
||||
bases: list[expr]
|
||||
keywords: list[keyword]
|
||||
body: list[stmt]
|
||||
@@ -194,19 +194,19 @@ class Import(stmt):
|
||||
class ImportFrom(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("module", "names", "level")
|
||||
module: _identifier | None
|
||||
module: _Identifier | None
|
||||
names: list[alias]
|
||||
level: int
|
||||
|
||||
class Global(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("names",)
|
||||
names: list[_identifier]
|
||||
names: list[_Identifier]
|
||||
|
||||
class Nonlocal(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("names",)
|
||||
names: list[_identifier]
|
||||
names: list[_Identifier]
|
||||
|
||||
class Expr(stmt):
|
||||
if sys.version_info >= (3, 10):
|
||||
@@ -362,7 +362,7 @@ class Attribute(expr):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("value", "attr", "ctx")
|
||||
value: expr
|
||||
attr: _identifier
|
||||
attr: _Identifier
|
||||
ctx: expr_context
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@@ -401,7 +401,7 @@ class Starred(expr):
|
||||
class Name(expr):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("id", "ctx")
|
||||
id: _identifier
|
||||
id: _Identifier
|
||||
ctx: expr_context
|
||||
|
||||
class List(expr):
|
||||
@@ -479,7 +479,7 @@ class ExceptHandler(excepthandler):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("type", "name", "body")
|
||||
type: expr | None
|
||||
name: _identifier | None
|
||||
name: _Identifier | None
|
||||
body: list[stmt]
|
||||
|
||||
class arguments(AST):
|
||||
@@ -497,20 +497,20 @@ class arguments(AST):
|
||||
class arg(AST):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("arg", "annotation", "type_comment")
|
||||
arg: _identifier
|
||||
arg: _Identifier
|
||||
annotation: expr | None
|
||||
|
||||
class keyword(AST):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("arg", "value")
|
||||
arg: _identifier | None
|
||||
arg: _Identifier | None
|
||||
value: expr
|
||||
|
||||
class alias(AST):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("name", "asname")
|
||||
name: _identifier
|
||||
asname: _identifier | None
|
||||
name: _Identifier
|
||||
asname: _Identifier | None
|
||||
|
||||
class withitem(AST):
|
||||
if sys.version_info >= (3, 10):
|
||||
@@ -526,11 +526,11 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
class pattern(AST): ...
|
||||
# Without the alias, Pyright complains variables named pattern are recursively defined
|
||||
_pattern: TypeAlias = pattern
|
||||
_Pattern: TypeAlias = pattern
|
||||
|
||||
class match_case(AST):
|
||||
__match_args__ = ("pattern", "guard", "body")
|
||||
pattern: _pattern
|
||||
pattern: _Pattern
|
||||
guard: expr | None
|
||||
body: list[stmt]
|
||||
|
||||
@@ -548,25 +548,25 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
class MatchStar(pattern):
|
||||
__match_args__ = ("name",)
|
||||
name: _identifier | None
|
||||
name: _Identifier | None
|
||||
|
||||
class MatchMapping(pattern):
|
||||
__match_args__ = ("keys", "patterns", "rest")
|
||||
keys: list[expr]
|
||||
patterns: list[pattern]
|
||||
rest: _identifier | None
|
||||
rest: _Identifier | None
|
||||
|
||||
class MatchClass(pattern):
|
||||
__match_args__ = ("cls", "patterns", "kwd_attrs", "kwd_patterns")
|
||||
cls: expr
|
||||
patterns: list[pattern]
|
||||
kwd_attrs: list[_identifier]
|
||||
kwd_attrs: list[_Identifier]
|
||||
kwd_patterns: list[pattern]
|
||||
|
||||
class MatchAs(pattern):
|
||||
__match_args__ = ("pattern", "name")
|
||||
pattern: _pattern | None
|
||||
name: _identifier | None
|
||||
pattern: _Pattern | None
|
||||
name: _Identifier | None
|
||||
|
||||
class MatchOr(pattern):
|
||||
__match_args__ = ("patterns",)
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import IO, Any, NamedTuple, overload
|
||||
from typing_extensions import TypeAlias, final
|
||||
|
||||
if sys.platform != "win32":
|
||||
_chtype: TypeAlias = str | bytes | int
|
||||
_ChType: TypeAlias = str | bytes | int
|
||||
|
||||
# ACS codes are only initialized after initscr is called
|
||||
ACS_BBSS: int
|
||||
@@ -365,9 +365,9 @@ if sys.platform != "win32":
|
||||
__i9: int = ...,
|
||||
) -> bytes: ...
|
||||
def typeahead(__fd: int) -> None: ...
|
||||
def unctrl(__ch: _chtype) -> bytes: ...
|
||||
def unctrl(__ch: _ChType) -> bytes: ...
|
||||
def unget_wch(__ch: int | str) -> None: ...
|
||||
def ungetch(__ch: _chtype) -> None: ...
|
||||
def ungetch(__ch: _ChType) -> None: ...
|
||||
def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ...
|
||||
def update_lines_cols() -> None: ...
|
||||
def use_default_colors() -> None: ...
|
||||
@@ -379,9 +379,9 @@ if sys.platform != "win32":
|
||||
class _CursesWindow:
|
||||
encoding: str
|
||||
@overload
|
||||
def addch(self, ch: _chtype, attr: int = ...) -> None: ...
|
||||
def addch(self, ch: _ChType, attr: int = ...) -> None: ...
|
||||
@overload
|
||||
def addch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ...
|
||||
def addch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ...
|
||||
@overload
|
||||
def addnstr(self, str: str, n: int, attr: int = ...) -> None: ...
|
||||
@overload
|
||||
@@ -393,23 +393,23 @@ if sys.platform != "win32":
|
||||
def attroff(self, __attr: int) -> None: ...
|
||||
def attron(self, __attr: int) -> None: ...
|
||||
def attrset(self, __attr: int) -> None: ...
|
||||
def bkgd(self, __ch: _chtype, __attr: int = ...) -> None: ...
|
||||
def bkgdset(self, __ch: _chtype, __attr: int = ...) -> None: ...
|
||||
def bkgd(self, __ch: _ChType, __attr: int = ...) -> None: ...
|
||||
def bkgdset(self, __ch: _ChType, __attr: int = ...) -> None: ...
|
||||
def border(
|
||||
self,
|
||||
ls: _chtype = ...,
|
||||
rs: _chtype = ...,
|
||||
ts: _chtype = ...,
|
||||
bs: _chtype = ...,
|
||||
tl: _chtype = ...,
|
||||
tr: _chtype = ...,
|
||||
bl: _chtype = ...,
|
||||
br: _chtype = ...,
|
||||
ls: _ChType = ...,
|
||||
rs: _ChType = ...,
|
||||
ts: _ChType = ...,
|
||||
bs: _ChType = ...,
|
||||
tl: _ChType = ...,
|
||||
tr: _ChType = ...,
|
||||
bl: _ChType = ...,
|
||||
br: _ChType = ...,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def box(self) -> None: ...
|
||||
@overload
|
||||
def box(self, vertch: _chtype = ..., horch: _chtype = ...) -> None: ...
|
||||
def box(self, vertch: _ChType = ..., horch: _ChType = ...) -> None: ...
|
||||
@overload
|
||||
def chgat(self, attr: int) -> None: ...
|
||||
@overload
|
||||
@@ -432,7 +432,7 @@ if sys.platform != "win32":
|
||||
def derwin(self, begin_y: int, begin_x: int) -> _CursesWindow: ...
|
||||
@overload
|
||||
def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> _CursesWindow: ...
|
||||
def echochar(self, __ch: _chtype, __attr: int = ...) -> None: ...
|
||||
def echochar(self, __ch: _ChType, __attr: int = ...) -> None: ...
|
||||
def enclose(self, __y: int, __x: int) -> bool: ...
|
||||
def erase(self) -> None: ...
|
||||
def getbegyx(self) -> tuple[int, int]: ...
|
||||
@@ -461,9 +461,9 @@ if sys.platform != "win32":
|
||||
def getstr(self, y: int, x: int, n: int) -> bytes: ...
|
||||
def getyx(self) -> tuple[int, int]: ...
|
||||
@overload
|
||||
def hline(self, ch: _chtype, n: int) -> None: ...
|
||||
def hline(self, ch: _ChType, n: int) -> None: ...
|
||||
@overload
|
||||
def hline(self, y: int, x: int, ch: _chtype, n: int) -> None: ...
|
||||
def hline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...
|
||||
def idcok(self, flag: bool) -> None: ...
|
||||
def idlok(self, yes: bool) -> None: ...
|
||||
def immedok(self, flag: bool) -> None: ...
|
||||
@@ -472,9 +472,9 @@ if sys.platform != "win32":
|
||||
@overload
|
||||
def inch(self, y: int, x: int) -> int: ...
|
||||
@overload
|
||||
def insch(self, ch: _chtype, attr: int = ...) -> None: ...
|
||||
def insch(self, ch: _ChType, attr: int = ...) -> None: ...
|
||||
@overload
|
||||
def insch(self, y: int, x: int, ch: _chtype, attr: int = ...) -> None: ...
|
||||
def insch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ...
|
||||
def insdelln(self, nlines: int) -> None: ...
|
||||
def insertln(self) -> None: ...
|
||||
@overload
|
||||
@@ -543,9 +543,9 @@ if sys.platform != "win32":
|
||||
def touchwin(self) -> None: ...
|
||||
def untouchwin(self) -> None: ...
|
||||
@overload
|
||||
def vline(self, ch: _chtype, n: int) -> None: ...
|
||||
def vline(self, ch: _ChType, n: int) -> None: ...
|
||||
@overload
|
||||
def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ...
|
||||
def vline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
class _ncurses_version(NamedTuple):
|
||||
major: int
|
||||
|
||||
@@ -3,14 +3,14 @@ from typing_extensions import TypeAlias
|
||||
from weakref import ReferenceType
|
||||
|
||||
__all__ = ["local"]
|
||||
_localdict: TypeAlias = dict[Any, Any]
|
||||
_LocalDict: TypeAlias = dict[Any, Any]
|
||||
|
||||
class _localimpl:
|
||||
key: str
|
||||
dicts: dict[int, tuple[ReferenceType[Any], _localdict]]
|
||||
dicts: dict[int, tuple[ReferenceType[Any], _LocalDict]]
|
||||
def __init__(self) -> None: ...
|
||||
def get_dict(self) -> _localdict: ...
|
||||
def create_dict(self) -> _localdict: ...
|
||||
def get_dict(self) -> _LocalDict: ...
|
||||
def create_dict(self) -> _LocalDict: ...
|
||||
|
||||
class local:
|
||||
def __getattribute__(self, name: str) -> Any: ...
|
||||
|
||||
@@ -9,7 +9,7 @@ class simple_producer:
|
||||
class async_chat(asyncore.dispatcher):
|
||||
ac_in_buffer_size: int
|
||||
ac_out_buffer_size: int
|
||||
def __init__(self, sock: socket.socket | None = ..., map: asyncore._maptype | None = ...) -> None: ...
|
||||
def __init__(self, sock: socket.socket | None = ..., map: asyncore._MapType | None = ...) -> None: ...
|
||||
@abstractmethod
|
||||
def collect_incoming_data(self, data: bytes) -> None: ...
|
||||
@abstractmethod
|
||||
|
||||
@@ -5,22 +5,22 @@ from typing import Any, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# cyclic dependence with asynchat
|
||||
_maptype: TypeAlias = dict[int, Any]
|
||||
_socket: TypeAlias = socket
|
||||
_MapType: TypeAlias = dict[int, Any]
|
||||
_Socket: TypeAlias = socket
|
||||
|
||||
socket_map: _maptype # undocumented
|
||||
socket_map: _MapType # undocumented
|
||||
|
||||
class ExitNow(Exception): ...
|
||||
|
||||
def read(obj: Any) -> None: ...
|
||||
def write(obj: Any) -> None: ...
|
||||
def readwrite(obj: Any, flags: int) -> None: ...
|
||||
def poll(timeout: float = ..., map: _maptype | None = ...) -> None: ...
|
||||
def poll2(timeout: float = ..., map: _maptype | None = ...) -> None: ...
|
||||
def poll(timeout: float = ..., map: _MapType | None = ...) -> None: ...
|
||||
def poll2(timeout: float = ..., map: _MapType | None = ...) -> None: ...
|
||||
|
||||
poll3 = poll2
|
||||
|
||||
def loop(timeout: float = ..., use_poll: bool = ..., map: _maptype | None = ..., count: int | None = ...) -> None: ...
|
||||
def loop(timeout: float = ..., use_poll: bool = ..., map: _MapType | None = ..., count: int | None = ...) -> None: ...
|
||||
|
||||
# Not really subclass of socket.socket; it's only delegation.
|
||||
# It is not covariant to it.
|
||||
@@ -32,19 +32,19 @@ class dispatcher:
|
||||
connecting: bool
|
||||
closing: bool
|
||||
ignore_log_types: frozenset[str]
|
||||
socket: _socket | None
|
||||
def __init__(self, sock: _socket | None = ..., map: _maptype | None = ...) -> None: ...
|
||||
def add_channel(self, map: _maptype | None = ...) -> None: ...
|
||||
def del_channel(self, map: _maptype | None = ...) -> None: ...
|
||||
socket: _Socket | None
|
||||
def __init__(self, sock: _Socket | None = ..., map: _MapType | None = ...) -> None: ...
|
||||
def add_channel(self, map: _MapType | None = ...) -> None: ...
|
||||
def del_channel(self, map: _MapType | None = ...) -> None: ...
|
||||
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
|
||||
def set_socket(self, sock: _socket, map: _maptype | None = ...) -> None: ...
|
||||
def set_socket(self, sock: _Socket, map: _MapType | None = ...) -> None: ...
|
||||
def set_reuse_addr(self) -> None: ...
|
||||
def readable(self) -> bool: ...
|
||||
def writable(self) -> bool: ...
|
||||
def listen(self, num: int) -> None: ...
|
||||
def bind(self, addr: tuple[Any, ...] | str) -> None: ...
|
||||
def connect(self, address: tuple[Any, ...] | str) -> None: ...
|
||||
def accept(self) -> tuple[_socket, Any] | None: ...
|
||||
def accept(self) -> tuple[_Socket, Any] | None: ...
|
||||
def send(self, data: bytes) -> int: ...
|
||||
def recv(self, buffer_size: int) -> bytes: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -63,14 +63,14 @@ class dispatcher:
|
||||
def handle_close(self) -> None: ...
|
||||
|
||||
class dispatcher_with_send(dispatcher):
|
||||
def __init__(self, sock: socket | None = ..., map: _maptype | None = ...) -> None: ...
|
||||
def __init__(self, sock: socket | None = ..., map: _MapType | None = ...) -> None: ...
|
||||
def initiate_send(self) -> None: ...
|
||||
def handle_write(self) -> None: ...
|
||||
# incompatible signature:
|
||||
# def send(self, data: bytes) -> int | None: ...
|
||||
|
||||
def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ...
|
||||
def close_all(map: _maptype | None = ..., ignore_all: bool = ...) -> None: ...
|
||||
def close_all(map: _MapType | None = ..., ignore_all: bool = ...) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
class file_wrapper:
|
||||
@@ -88,5 +88,5 @@ if sys.platform != "win32":
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
class file_dispatcher(dispatcher):
|
||||
def __init__(self, fd: FileDescriptorLike, map: _maptype | None = ...) -> None: ...
|
||||
def __init__(self, fd: FileDescriptorLike, map: _MapType | None = ...) -> None: ...
|
||||
def set_file(self, fd: int) -> None: ...
|
||||
|
||||
@@ -21,7 +21,7 @@ class tzinfo:
|
||||
def fromutc(self, __dt: datetime) -> datetime: ...
|
||||
|
||||
# Alias required to avoid name conflicts with date(time).tzinfo.
|
||||
_tzinfo: TypeAlias = tzinfo
|
||||
_TzInfo: TypeAlias = tzinfo
|
||||
|
||||
@final
|
||||
class timezone(tzinfo):
|
||||
@@ -113,7 +113,7 @@ class time:
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
tzinfo: _TzInfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> Self: ...
|
||||
@@ -126,7 +126,7 @@ class time:
|
||||
@property
|
||||
def microsecond(self) -> int: ...
|
||||
@property
|
||||
def tzinfo(self) -> _tzinfo | None: ...
|
||||
def tzinfo(self) -> _TzInfo | None: ...
|
||||
@property
|
||||
def fold(self) -> int: ...
|
||||
def __le__(self, __other: time) -> bool: ...
|
||||
@@ -150,13 +150,13 @@ class time:
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
tzinfo: _TzInfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> Self: ...
|
||||
|
||||
_date: TypeAlias = date
|
||||
_time: TypeAlias = time
|
||||
_Date: TypeAlias = date
|
||||
_Time: TypeAlias = time
|
||||
|
||||
class timedelta(SupportsAbs[timedelta]):
|
||||
min: ClassVar[timedelta]
|
||||
@@ -218,7 +218,7 @@ class datetime(date):
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
tzinfo: _TzInfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> Self: ...
|
||||
@@ -231,40 +231,40 @@ class datetime(date):
|
||||
@property
|
||||
def microsecond(self) -> int: ...
|
||||
@property
|
||||
def tzinfo(self) -> _tzinfo | None: ...
|
||||
def tzinfo(self) -> _TzInfo | None: ...
|
||||
@property
|
||||
def fold(self) -> int: ...
|
||||
# The first parameter in `fromtimestamp` is actually positional-or-keyword,
|
||||
# but it is named "timestamp" in the C implementation and "t" in the Python implementation,
|
||||
# so it is only truly *safe* to pass it as a positional argument.
|
||||
@classmethod
|
||||
def fromtimestamp(cls: type[Self], __timestamp: float, tz: _tzinfo | None = ...) -> Self: ...
|
||||
def fromtimestamp(cls: type[Self], __timestamp: float, tz: _TzInfo | None = ...) -> Self: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls: type[Self], __t: float) -> Self: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@classmethod
|
||||
def now(cls: type[Self], tz: _tzinfo | None = ...) -> Self: ...
|
||||
def now(cls: type[Self], tz: _TzInfo | None = ...) -> Self: ...
|
||||
else:
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls: type[Self], tz: None = ...) -> Self: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def now(cls, tz: _tzinfo) -> datetime: ...
|
||||
def now(cls, tz: _TzInfo) -> datetime: ...
|
||||
|
||||
@classmethod
|
||||
def utcnow(cls: type[Self]) -> Self: ...
|
||||
@classmethod
|
||||
def combine(cls, date: _date, time: _time, tzinfo: _tzinfo | None = ...) -> datetime: ...
|
||||
def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo | None = ...) -> datetime: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
@classmethod
|
||||
def fromisoformat(cls: type[Self], __date_string: str) -> Self: ...
|
||||
|
||||
def timestamp(self) -> float: ...
|
||||
def utctimetuple(self) -> struct_time: ...
|
||||
def date(self) -> _date: ...
|
||||
def time(self) -> _time: ...
|
||||
def timetz(self) -> _time: ...
|
||||
def date(self) -> _Date: ...
|
||||
def time(self) -> _Time: ...
|
||||
def timetz(self) -> _Time: ...
|
||||
def replace(
|
||||
self: Self,
|
||||
year: int = ...,
|
||||
@@ -274,14 +274,14 @@ class datetime(date):
|
||||
minute: int = ...,
|
||||
second: int = ...,
|
||||
microsecond: int = ...,
|
||||
tzinfo: _tzinfo | None = ...,
|
||||
tzinfo: _TzInfo | None = ...,
|
||||
*,
|
||||
fold: int = ...,
|
||||
) -> Self: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def astimezone(self: Self, tz: _tzinfo | None = ...) -> Self: ...
|
||||
def astimezone(self: Self, tz: _TzInfo | None = ...) -> Self: ...
|
||||
else:
|
||||
def astimezone(self, tz: _tzinfo | None = ...) -> datetime: ...
|
||||
def astimezone(self, tz: _TzInfo | None = ...) -> datetime: ...
|
||||
|
||||
def ctime(self) -> str: ...
|
||||
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
|
||||
|
||||
@@ -145,7 +145,7 @@ class PickleError(Exception): ...
|
||||
class PicklingError(PickleError): ...
|
||||
class UnpicklingError(PickleError): ...
|
||||
|
||||
_reducedtype: TypeAlias = Union[
|
||||
_ReducedType: TypeAlias = Union[
|
||||
str,
|
||||
tuple[Callable[..., Any], tuple[Any, ...]],
|
||||
tuple[Callable[..., Any], tuple[Any, ...], Any],
|
||||
@@ -155,7 +155,7 @@ _reducedtype: TypeAlias = Union[
|
||||
|
||||
class Pickler:
|
||||
fast: bool
|
||||
dispatch_table: Mapping[type, Callable[[Any], _reducedtype]]
|
||||
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
|
||||
bin: bool # undocumented
|
||||
dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class SMTPChannel(asynchat.async_chat):
|
||||
conn: socket.socket,
|
||||
addr: Any,
|
||||
data_size_limit: int = ...,
|
||||
map: asyncore._maptype | None = ...,
|
||||
map: asyncore._MapType | None = ...,
|
||||
enable_SMTPUTF8: bool = ...,
|
||||
decode_data: bool = ...,
|
||||
) -> None: ...
|
||||
@@ -72,7 +72,7 @@ class SMTPServer(asyncore.dispatcher):
|
||||
localaddr: _Address,
|
||||
remoteaddr: _Address,
|
||||
data_size_limit: int = ...,
|
||||
map: asyncore._maptype | None = ...,
|
||||
map: asyncore._MapType | None = ...,
|
||||
enable_SMTPUTF8: bool = ...,
|
||||
decode_data: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -75,7 +75,7 @@ _xoptions: dict[Any, Any]
|
||||
|
||||
# Type alias used as a mixin for structseq classes that cannot be instantiated at runtime
|
||||
# This can't be represented in the type system, so we just use `structseq[Any]`
|
||||
_uninstantiable_structseq: TypeAlias = structseq[Any]
|
||||
_UninstantiableStructseq: TypeAlias = structseq[Any]
|
||||
|
||||
flags: _flags
|
||||
|
||||
@@ -87,7 +87,7 @@ else:
|
||||
_FlagTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int, int, int, int]
|
||||
|
||||
@final
|
||||
class _flags(_uninstantiable_structseq, _FlagTuple):
|
||||
class _flags(_UninstantiableStructseq, _FlagTuple):
|
||||
@property
|
||||
def debug(self) -> int: ...
|
||||
@property
|
||||
@@ -198,7 +198,7 @@ class _int_info(structseq[int], tuple[int, int]):
|
||||
def sizeof_digit(self) -> int: ...
|
||||
|
||||
@final
|
||||
class _version_info(_uninstantiable_structseq, tuple[int, int, int, str, int]):
|
||||
class _version_info(_UninstantiableStructseq, tuple[int, int, int, str, int]):
|
||||
@property
|
||||
def major(self) -> int: ...
|
||||
@property
|
||||
@@ -249,7 +249,7 @@ def settrace(tracefunc: TraceFunction | None) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
# A tuple of length 5, even though it has more than 5 attributes.
|
||||
@final
|
||||
class _WinVersion(_uninstantiable_structseq, tuple[int, int, int, int, str]):
|
||||
class _WinVersion(_UninstantiableStructseq, tuple[int, int, int, int, str]):
|
||||
@property
|
||||
def major(self) -> int: ...
|
||||
@property
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
import types
|
||||
from _typeshed import StrPath
|
||||
from _typeshed import StrPath, TraceFunction
|
||||
from collections.abc import Callable, Mapping, Sequence
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import ParamSpec, TypeAlias
|
||||
@@ -9,16 +9,15 @@ __all__ = ["Trace", "CoverageResults"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
_localtrace: TypeAlias = Callable[[types.FrameType, str, Any], Callable[..., Any]]
|
||||
_fileModuleFunction: TypeAlias = tuple[str, str | None, str]
|
||||
_FileModuleFunction: TypeAlias = tuple[str, str | None, str]
|
||||
|
||||
class CoverageResults:
|
||||
def __init__(
|
||||
self,
|
||||
counts: dict[tuple[str, int], int] | None = ...,
|
||||
calledfuncs: dict[_fileModuleFunction, int] | None = ...,
|
||||
calledfuncs: dict[_FileModuleFunction, int] | None = ...,
|
||||
infile: StrPath | None = ...,
|
||||
callers: dict[tuple[_fileModuleFunction, _fileModuleFunction], int] | None = ...,
|
||||
callers: dict[tuple[_FileModuleFunction, _FileModuleFunction], int] | None = ...,
|
||||
outfile: StrPath | None = ...,
|
||||
) -> None: ... # undocumented
|
||||
def update(self, other: CoverageResults) -> None: ...
|
||||
@@ -50,11 +49,11 @@ class Trace:
|
||||
else:
|
||||
def runfunc(self, func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ...
|
||||
|
||||
def file_module_function_of(self, frame: types.FrameType) -> _fileModuleFunction: ...
|
||||
def file_module_function_of(self, frame: types.FrameType) -> _FileModuleFunction: ...
|
||||
def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ...
|
||||
def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ...
|
||||
def globaltrace_lt(self, frame: types.FrameType, why: str, arg: Any) -> None: ...
|
||||
def localtrace_trace_and_count(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ...
|
||||
def localtrace_trace(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ...
|
||||
def localtrace_count(self, frame: types.FrameType, why: str, arg: Any) -> _localtrace: ...
|
||||
def localtrace_trace_and_count(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ...
|
||||
def localtrace_trace(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ...
|
||||
def localtrace_count(self, frame: types.FrameType, why: str, arg: Any) -> TraceFunction: ...
|
||||
def results(self) -> CoverageResults: ...
|
||||
|
||||
@@ -6,19 +6,19 @@ from xml.etree.ElementTree import Element
|
||||
xpath_tokenizer_re: Pattern[str]
|
||||
|
||||
_token: TypeAlias = tuple[str, str]
|
||||
_next: TypeAlias = Callable[[], _token]
|
||||
_callback: TypeAlias = Callable[[_SelectorContext, list[Element]], Generator[Element, None, None]]
|
||||
_Next: TypeAlias = Callable[[], _token]
|
||||
_Callback: TypeAlias = Callable[[_SelectorContext, list[Element]], Generator[Element, None, None]]
|
||||
|
||||
def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = ...) -> Generator[_token, None, None]: ...
|
||||
def get_parent_map(context: _SelectorContext) -> dict[Element, Element]: ...
|
||||
def prepare_child(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_star(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_self(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_descendant(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_parent(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_predicate(next: _next, token: _token) -> _callback: ...
|
||||
def prepare_child(next: _Next, token: _token) -> _Callback: ...
|
||||
def prepare_star(next: _Next, token: _token) -> _Callback: ...
|
||||
def prepare_self(next: _Next, token: _token) -> _Callback: ...
|
||||
def prepare_descendant(next: _Next, token: _token) -> _Callback: ...
|
||||
def prepare_parent(next: _Next, token: _token) -> _Callback: ...
|
||||
def prepare_predicate(next: _Next, token: _token) -> _Callback: ...
|
||||
|
||||
ops: dict[str, Callable[[_next, _token], _callback]]
|
||||
ops: dict[str, Callable[[_Next, _token], _Callback]]
|
||||
|
||||
class _SelectorContext:
|
||||
parent_map: dict[Element, Element] | None
|
||||
|
||||
Reference in New Issue
Block a user