Revert "Updated typeshed stubs to the latest verison."

This reverts commit a6572d6418.
This commit is contained in:
Eric Traut 2023-06-07 10:30:23 -06:00
parent ee3c669bad
commit 62ede5625b
79 changed files with 490 additions and 1108 deletions

View File

@ -279,7 +279,7 @@ test('TypePrinter1', () => {
test('TypeAliasType1', () => {
const analysisResults = TestUtils.typeAnalyzeSampleFiles(['typeAliasType1.py']);
TestUtils.validateResults(analysisResults, 15);
TestUtils.validateResults(analysisResults, 13);
});
test('TypeAliasType2', () => {

View File

@ -1 +1 @@
e347af1d59ed46478a788ed60fd02096fce26edd
35450d9c0d673fc713c3210d8c25d19425f9790e

View File

@ -61,7 +61,7 @@ antigravity: 2.7-
argparse: 2.7-
array: 2.7-
ast: 2.7-
asynchat: 2.7-3.11
asynchat: 2.7-
asyncio: 3.4-
asyncio.mixins: 3.10-
asyncio.exceptions: 3.8-
@ -72,7 +72,7 @@ asyncio.taskgroups: 3.11-
asyncio.threads: 3.9-
asyncio.timeouts: 3.11-
asyncio.trsock: 3.8-
asyncore: 2.7-3.11
asyncore: 2.7-
atexit: 2.7-
audioop: 2.7-
base64: 2.7-
@ -112,7 +112,7 @@ dbm: 2.7-
decimal: 2.7-
difflib: 2.7-
dis: 2.7-
distutils: 2.7-3.11
distutils: 2.7-
distutils.command.bdist_msi: 2.7-3.10
distutils.command.bdist_wininst: 2.7-3.9
doctest: 2.7-
@ -228,7 +228,7 @@ shlex: 2.7-
shutil: 2.7-
signal: 2.7-
site: 2.7-
smtpd: 2.7-3.11
smtpd: 2.7-
smtplib: 2.7-
sndhdr: 2.7-
socket: 2.7-

View File

@ -1,14 +1,13 @@
import sys
import typing_extensions
from typing import Any, ClassVar
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
PyCF_ONLY_AST: Literal[1024]
if sys.version_info >= (3, 8):
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
_Identifier: typing_extensions.TypeAlias = str
_Identifier: TypeAlias = str
class AST:
if sys.version_info >= (3, 10):
@ -60,43 +59,31 @@ class Expression(mod):
class stmt(AST): ...
class FunctionDef(stmt):
if sys.version_info >= (3, 12):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment", "type_params")
elif sys.version_info >= (3, 10):
if sys.version_info >= (3, 10):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
name: _Identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
returns: expr | None
if sys.version_info >= (3, 12):
type_params: list[type_param]
class AsyncFunctionDef(stmt):
if sys.version_info >= (3, 12):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment", "type_params")
elif sys.version_info >= (3, 10):
if sys.version_info >= (3, 10):
__match_args__ = ("name", "args", "body", "decorator_list", "returns", "type_comment")
name: _Identifier
args: arguments
body: list[stmt]
decorator_list: list[expr]
returns: expr | None
if sys.version_info >= (3, 12):
type_params: list[type_param]
class ClassDef(stmt):
if sys.version_info >= (3, 12):
__match_args__ = ("name", "bases", "keywords", "body", "decorator_list", "type_params")
elif sys.version_info >= (3, 10):
if sys.version_info >= (3, 10):
__match_args__ = ("name", "bases", "keywords", "body", "decorator_list")
name: _Identifier
bases: list[expr]
keywords: list[keyword]
body: list[stmt]
decorator_list: list[expr]
if sys.version_info >= (3, 12):
type_params: list[type_param]
class Return(stmt):
if sys.version_info >= (3, 10):
@ -379,10 +366,10 @@ class Attribute(expr):
ctx: expr_context
if sys.version_info >= (3, 9):
_Slice: typing_extensions.TypeAlias = expr
_Slice: TypeAlias = expr
else:
class slice(AST): ...
_Slice: typing_extensions.TypeAlias = slice
_Slice: TypeAlias = slice
class Slice(_Slice):
if sys.version_info >= (3, 10):
@ -539,7 +526,7 @@ if sys.version_info >= (3, 10):
class pattern(AST): ...
# Without the alias, Pyright complains variables named pattern are recursively defined
_Pattern: typing_extensions.TypeAlias = pattern
_Pattern: TypeAlias = pattern
class match_case(AST):
__match_args__ = ("pattern", "guard", "body")
@ -584,25 +571,3 @@ if sys.version_info >= (3, 10):
class MatchOr(pattern):
__match_args__ = ("patterns",)
patterns: list[pattern]
if sys.version_info >= (3, 12):
class type_param(AST): ...
class TypeVar(type_param):
__match_args__ = ("name", "bound")
name: _Identifier
bound: expr | None
class ParamSpec(type_param):
__match_args__ = ("name",)
name: _Identifier
class TypeVarTuple(type_param):
__match_args__ = ("name",)
name: _Identifier
class TypeAlias(stmt):
__match_args__ = ("name", "typeparams", "value")
name: Name
type_params: list[type_param]
value: expr

View File

@ -1,5 +1,4 @@
import sys
from abc import abstractmethod
from types import MappingProxyType
from typing import ( # noqa: Y022,Y038
AbstractSet as Set,
@ -24,13 +23,11 @@ from typing import ( # noqa: Y022,Y038
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Protocol,
Reversible as Reversible,
Sequence as Sequence,
Sized as Sized,
TypeVar,
ValuesView as ValuesView,
runtime_checkable,
)
from typing_extensions import final
@ -61,8 +58,6 @@ __all__ = [
"MutableSequence",
"ByteString",
]
if sys.version_info >= (3, 12):
__all__ += ["Buffer"]
_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers.
_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
@ -84,9 +79,3 @@ class dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]): # undocum
if sys.version_info >= (3, 10):
@property
def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ...
if sys.version_info >= (3, 12):
@runtime_checkable
class Buffer(Protocol):
@abstractmethod
def __buffer__(self, __flags: int) -> memoryview: ...

View File

@ -1,4 +1,3 @@
import sys
from _typeshed import SupportsWrite
from collections.abc import Iterable, Iterator
from typing import Any
@ -10,9 +9,6 @@ QUOTE_ALL: Literal[1]
QUOTE_MINIMAL: Literal[0]
QUOTE_NONE: Literal[3]
QUOTE_NONNUMERIC: Literal[2]
if sys.version_info >= (3, 12):
QUOTE_STRINGS: Literal[4]
QUOTE_NOTNULL: Literal[5]
# Ideally this would be `QUOTE_ALL | QUOTE_MINIMAL | QUOTE_NONE | QUOTE_NONNUMERIC`
# However, using literals in situations like these can cause false-positives (see #7258)

View File

@ -63,8 +63,6 @@ class _CData(metaclass=_CDataMeta):
def from_param(cls, obj: Any) -> Self | _CArgObject: ...
@classmethod
def in_dll(cls, library: CDLL, name: str) -> Self: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
class _SimpleCData(Generic[_T], _CData):
value: _T

View File

@ -692,28 +692,3 @@ if sys.platform != "win32" or sys.version_info >= (3, 8):
def if_nameindex() -> list[tuple[int, str]]: ...
def if_nametoindex(__name: str) -> int: ...
def if_indextoname(__index: int) -> str: ...
if sys.version_info >= (3, 12):
IP_PKTINFO: int
IP_UNBLOCK_SOURCE: int
IP_BLOCK_SOURCE: int
IP_ADD_SOURCE_MEMBERSHIP: int
IP_DROP_SOURCE_MEMBERSHIP: int
if sys.platform == "win32":
AF_HYPERV: int
HV_PROTOCOL_RAW: int
HVSOCKET_CONNECT_TIMEOUT: int
HVSOCKET_CONNECT_TIMEOUT_MAX: int
HVSOCKET_CONNECTED_SUSPEND: int
HVSOCKET_ADDRESS_FLAG_PASSTHRU: int
HV_GUID_ZERO: str
HV_GUID_WILDCARD: str
HV_GUID_BROADCAST: str
HV_GUID_CHILDREN: str
HV_GUID_LOOPBACK: str
HV_GUID_PARENT: str
else:
ETHERTYPE_ARP: int
ETHERTYPE_IP: int
ETHERTYPE_IPV6: int
ETHERTYPE_VLAN: int

View File

@ -2,13 +2,17 @@
#
# See the README.md file in this directory for more information.
import array
import ctypes
import mmap
import pickle
import sys
from collections.abc import Awaitable, Callable, Iterable, Sequence, Set as AbstractSet, Sized
from collections.abc import Awaitable, Callable, Iterable, Set as AbstractSet
from dataclasses import Field
from os import PathLike
from types import FrameType, TracebackType
from typing import Any, AnyStr, ClassVar, Generic, Protocol, TypeVar, overload
from typing_extensions import Buffer, Final, Literal, LiteralString, TypeAlias, final
from typing import Any, AnyStr, ClassVar, Generic, Protocol, TypeVar
from typing_extensions import Final, Literal, LiteralString, TypeAlias, final
_KT = TypeVar("_KT")
_KT_co = TypeVar("_KT_co", covariant=True)
@ -223,33 +227,42 @@ class SupportsNoArgReadline(Protocol[_T_co]):
class SupportsWrite(Protocol[_T_contra]):
def write(self, __s: _T_contra) -> object: ...
# Unfortunately PEP 688 does not allow us to distinguish read-only
# from writable buffers. We use these aliases for readability for now.
# Perhaps a future extension of the buffer protocol will allow us to
# distinguish these cases in the type system.
ReadOnlyBuffer: TypeAlias = Buffer # stable
ReadOnlyBuffer: TypeAlias = bytes # stable
# Anything that implements the read-write buffer interface.
WriteableBuffer: TypeAlias = Buffer
# Same as WriteableBuffer, but also includes read-only buffer types (like bytes).
ReadableBuffer: TypeAlias = Buffer # stable
# The buffer interface is defined purely on the C level, so we cannot define a normal Protocol
# for it (until PEP 688 is implemented). Instead we have to list the most common stdlib buffer classes in a Union.
if sys.version_info >= (3, 8):
WriteableBuffer: TypeAlias = (
bytearray | memoryview | array.array[Any] | mmap.mmap | ctypes._CData | pickle.PickleBuffer
) # stable
else:
WriteableBuffer: TypeAlias = bytearray | memoryview | array.array[Any] | mmap.mmap | ctypes._CData # stable
# Same as _WriteableBuffer, but also includes read-only buffer types (like bytes).
ReadableBuffer: TypeAlias = ReadOnlyBuffer | WriteableBuffer # stable
_BufferWithLen: TypeAlias = ReadableBuffer # not stable # noqa: Y047
class SliceableBuffer(Buffer, Protocol):
def __getitem__(self, __slice: slice) -> Sequence[int]: ...
class IndexableBuffer(Buffer, Protocol):
def __getitem__(self, __i: int) -> int: ...
class SupportsGetItemBuffer(SliceableBuffer, IndexableBuffer, Protocol):
def __contains__(self, __x: Any) -> bool: ...
@overload
def __getitem__(self, __slice: slice) -> Sequence[int]: ...
@overload
def __getitem__(self, __i: int) -> int: ...
class SizedBuffer(Sized, Buffer, Protocol): ...
# for compatibility with third-party stubs that may use this
_BufferWithLen: TypeAlias = SizedBuffer # not stable # noqa: Y047
# Anything that implements the read-write buffer interface, and can be sliced/indexed.
SliceableBuffer: TypeAlias = bytes | bytearray | memoryview | array.array[Any] | mmap.mmap
IndexableBuffer: TypeAlias = bytes | bytearray | memoryview | array.array[Any] | mmap.mmap
# https://github.com/python/typeshed/pull/9115#issuecomment-1304905864
# Post PEP 688, they should be rewritten as such:
# from collections.abc import Sequence
# from typing import Sized, overload
# class SliceableBuffer(Protocol):
# def __buffer__(self, __flags: int) -> memoryview: ...
# def __getitem__(self, __slice: slice) -> Sequence[int]: ...
# class IndexableBuffer(Protocol):
# def __buffer__(self, __flags: int) -> memoryview: ...
# def __getitem__(self, __i: int) -> int: ...
# class SupportsGetItemBuffer(SliceableBuffer, IndexableBuffer, Protocol):
# def __buffer__(self, __flags: int) -> memoryview: ...
# def __contains__(self, __x: Any) -> bool: ...
# @overload
# def __getitem__(self, __slice: slice) -> Sequence[int]: ...
# @overload
# def __getitem__(self, __i: int) -> int: ...
# class SizedBuffer(Sized, Protocol): # instead of _BufferWithLen
# def __buffer__(self, __flags: int) -> memoryview: ...
ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, TracebackType]
OptExcInfo: TypeAlias = ExcInfo | tuple[None, None, None]

View File

@ -2,7 +2,7 @@ import sys
from collections.abc import Callable, Generator, Iterable, Sequence
from re import Pattern
from typing import IO, Any, Generic, NewType, NoReturn, Protocol, TypeVar, overload
from typing_extensions import Literal, Self, TypeAlias
from typing_extensions import Literal, TypeAlias
__all__ = [
"ArgumentParser",
@ -97,16 +97,8 @@ class _ActionsContainer:
version: str = ...,
**kwargs: Any,
) -> Action: ...
def add_argument_group(
self,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> _ArgumentGroup: ...
def add_mutually_exclusive_group(self, *, required: bool = False) -> _MutuallyExclusiveGroup: ...
def add_argument_group(self, *args: Any, **kwargs: Any) -> _ArgumentGroup: ...
def add_mutually_exclusive_group(self, **kwargs: Any) -> _MutuallyExclusiveGroup: ...
def _add_action(self, action: _ActionT) -> _ActionT: ...
def _remove_action(self, action: Action) -> None: ...
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
@ -244,19 +236,11 @@ class HelpFormatter:
_current_indent: int
_level: int
_action_max_length: int
_root_section: _Section
_current_section: _Section
_root_section: Any
_current_section: Any
_whitespace_matcher: Pattern[str]
_long_break_matcher: Pattern[str]
class _Section:
formatter: HelpFormatter
heading: str | None
parent: Self | None
items: list[tuple[Callable[..., str], Iterable[Any]]]
def __init__(self, formatter: HelpFormatter, parent: Self | None, heading: str | None = None) -> None: ...
def format_help(self) -> str: ...
_Section: type[Any] # Nested class
def __init__(self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None) -> None: ...
def _indent(self) -> None: ...
def _dedent(self) -> None: ...
@ -265,16 +249,16 @@ class HelpFormatter:
def end_section(self) -> None: ...
def add_text(self, text: str | None) -> None: ...
def add_usage(
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_MutuallyExclusiveGroup], prefix: str | None = None
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None = None
) -> None: ...
def add_argument(self, action: Action) -> None: ...
def add_arguments(self, actions: Iterable[Action]) -> None: ...
def format_help(self) -> str: ...
def _join_parts(self, part_strings: Iterable[str]) -> str: ...
def _format_usage(
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_MutuallyExclusiveGroup], prefix: str | None
self, usage: str | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None
) -> str: ...
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_MutuallyExclusiveGroup]) -> str: ...
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> str: ...
def _format_text(self, text: str) -> str: ...
def _format_action(self, action: Action) -> str: ...
def _format_action_invocation(self, action: Action) -> str: ...
@ -358,14 +342,7 @@ class _ArgumentGroup(_ActionsContainer):
title: str | None
_group_actions: list[Action]
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
self, container: _ActionsContainer, title: str | None = None, description: str | None = None, **kwargs: Any
) -> None: ...
# undocumented

View File

@ -80,7 +80,5 @@ class array(MutableSequence[_T], Generic[_T]):
def __rmul__(self, __value: int) -> array[_T]: ...
def __copy__(self) -> array[_T]: ...
def __deepcopy__(self, __unused: Any) -> array[_T]: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
ArrayType = array

View File

@ -3,7 +3,7 @@ import sys
from _ast import *
from _typeshed import ReadableBuffer, Unused
from collections.abc import Iterator
from typing import Any, TypeVar as _TypeVar, overload
from typing import Any, TypeVar, overload
from typing_extensions import Literal
if sys.version_info >= (3, 8):
@ -168,7 +168,7 @@ class NodeTransformer(NodeVisitor):
# The usual return type is AST | None, but Iterable[AST]
# is also allowed in some cases -- this needs to be mapped.
_T = _TypeVar("_T", bound=AST)
_T = TypeVar("_T", bound=AST)
if sys.version_info >= (3, 8):
@overload

View File

@ -1,4 +1,4 @@
from _typeshed import SizedBuffer
from _typeshed import _BufferWithLen
from typing import IO, Any
from typing_extensions import Literal, TypeAlias
@ -28,9 +28,9 @@ class openrsrc:
class BinHex:
def __init__(self, name_finfo_dlen_rlen: _FileInfoTuple, ofp: _FileHandleUnion) -> None: ...
def write(self, data: SizedBuffer) -> None: ...
def write(self, data: _BufferWithLen) -> None: ...
def close_data(self) -> None: ...
def write_rsrc(self, data: SizedBuffer) -> None: ...
def write_rsrc(self, data: _BufferWithLen) -> None: ...
def close(self) -> None: ...
def binhex(inp: str, out: str) -> None: ...

View File

@ -36,6 +36,7 @@ from typing import ( # noqa: Y022
IO,
Any,
BinaryIO,
ByteString,
ClassVar,
Generic,
Mapping,
@ -53,18 +54,7 @@ from typing import ( # noqa: Y022
overload,
type_check_only,
)
from typing_extensions import ( # type: ignore
Concatenate,
Literal,
LiteralString,
ParamSpec,
Self,
SupportsIndex,
TypeAlias,
TypeGuard,
TypeVarTuple,
final,
)
from typing_extensions import Concatenate, Literal, LiteralString, ParamSpec, Self, SupportsIndex, TypeAlias, TypeGuard, final
if sys.version_info >= (3, 9):
from types import GenericAlias
@ -198,8 +188,6 @@ class type:
if sys.version_info >= (3, 10):
def __or__(self, __value: Any) -> types.UnionType: ...
def __ror__(self, __value: Any) -> types.UnionType: ...
if sys.version_info >= (3, 12):
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
class super:
@overload
@ -257,9 +245,6 @@ class int:
signed: bool = False,
) -> Self: ...
if sys.version_info >= (3, 12):
def is_integer(self) -> Literal[True]: ...
def __add__(self, __value: int) -> int: ...
def __sub__(self, __value: int) -> int: ...
def __mul__(self, __value: int) -> int: ...
@ -465,7 +450,7 @@ class str(Sequence[str]):
@overload
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
@overload
def format(self, *args: object, **kwargs: object) -> str: ... # type: ignore
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def isalnum(self) -> bool: ...
@ -595,7 +580,7 @@ class str(Sequence[str]):
@overload
def __mod__(self: LiteralString, __value: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ...
@overload
def __mod__(self, __value: Any) -> str: ... # type: ignore
def __mod__(self, __value: Any) -> str: ...
@overload
def __mul__(self: LiteralString, __value: SupportsIndex) -> LiteralString: ...
@overload
@ -607,7 +592,7 @@ class str(Sequence[str]):
def __rmul__(self, __value: SupportsIndex) -> str: ... # type: ignore[misc]
def __getnewargs__(self) -> tuple[str]: ...
class bytes(Sequence[int]):
class bytes(ByteString):
@overload
def __new__(cls, __o: Iterable[SupportsIndex] | SupportsIndex | SupportsBytes | ReadableBuffer) -> Self: ...
@overload
@ -710,9 +695,7 @@ class bytes(Sequence[int]):
if sys.version_info >= (3, 11):
def __bytes__(self) -> bytes: ...
def __buffer__(self, __flags: int) -> memoryview: ...
class bytearray(MutableSequence[int]):
class bytearray(MutableSequence[int], ByteString):
@overload
def __init__(self) -> None: ...
@overload
@ -827,8 +810,6 @@ class bytearray(MutableSequence[int]):
def __gt__(self, __value: ReadableBuffer) -> bool: ...
def __ge__(self, __value: ReadableBuffer) -> bool: ...
def __alloc__(self) -> int: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
@final
class memoryview(Sequence[int]):
@ -890,9 +871,6 @@ class memoryview(Sequence[int]):
else:
def hex(self) -> str: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
@final
class bool(int):
def __new__(cls, __o: object = ...) -> Self: ...
@ -982,8 +960,6 @@ class function:
if sys.version_info >= (3, 10):
@property
def __builtins__(self) -> dict[str, Any]: ...
if sys.version_info >= (3, 12):
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
__module__: str
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
@ -1936,8 +1912,6 @@ class ImportError(Exception):
name: str | None
path: str | None
msg: str # undocumented
if sys.version_info >= (3, 12):
name_from: str | None # undocumented
class LookupError(Exception): ...
class MemoryError(Exception): ...

View File

@ -21,9 +21,6 @@ from _csv import (
unregister_dialect as unregister_dialect,
writer as writer,
)
if sys.version_info >= (3, 12):
from _csv import QUOTE_STRINGS as QUOTE_STRINGS, QUOTE_NOTNULL as QUOTE_NOTNULL
from _typeshed import SupportsWrite
from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence
from typing import Any, Generic, TypeVar, overload
@ -60,8 +57,6 @@ __all__ = [
"DictWriter",
"unix_dialect",
]
if sys.version_info >= (3, 12):
__all__ += ["QUOTE_STRINGS", "QUOTE_NOTNULL"]
_T = TypeVar("_T")

View File

@ -1,5 +0,0 @@
# Attempts to improve these stubs are probably not the best use of time:
# - distutils is deleted in Python 3.12 and newer
# - Most users already do not use stdlib distutils, due to setuptools monkeypatching
# - We have very little quality assurance on these stubs, since due to the two above issues
# we allowlist all distutils errors in stubtest.

View File

@ -1,7 +1,7 @@
import sys
from _typeshed import FileDescriptorLike, ReadOnlyBuffer, WriteableBuffer
from typing import Any, overload
from typing_extensions import Buffer, Literal
from typing_extensions import Literal
if sys.platform != "win32":
FASYNC: int
@ -20,9 +20,6 @@ if sys.platform != "win32":
F_SETOWN: int
F_UNLCK: int
F_WRLCK: int
F_GETLEASE: int
F_SETLEASE: int
if sys.platform == "darwin":
F_FULLFSYNC: int
F_NOCACHE: int
@ -33,9 +30,11 @@ if sys.platform != "win32":
F_SETSIG: int
F_SHLCK: int
F_SETLK64: int
F_SETLEASE: int
F_GETSIG: int
F_NOTIFY: int
F_EXLCK: int
F_GETLEASE: int
F_GETLK64: int
if sys.version_info >= (3, 8):
F_ADD_SEALS: int
@ -105,19 +104,13 @@ if sys.platform != "win32":
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = 0) -> int: ...
@overload
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: str | ReadOnlyBuffer) -> bytes: ...
# If arg is an int, return int
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: int = 0, __mutate_flag: bool = True) -> int: ...
# The return type works as follows:
# - If arg is a read-write buffer, return int if mutate_flag is True, otherwise bytes
# - If arg is a read-only buffer, return bytes (and ignore the value of mutate_flag)
# We can't represent that precisely as we can't distinguish between read-write and read-only
# buffers, so we add overloads for a few unambiguous cases and use Any for the rest.
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: bytes, __mutate_flag: bool = True) -> bytes: ...
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[True] = True) -> int: ...
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[False]) -> bytes: ...
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: Buffer, __mutate_flag: bool = True) -> Any: ...
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: ReadOnlyBuffer, __mutate_flag: bool = True) -> bytes: ...
def flock(__fd: FileDescriptorLike, __operation: int) -> None: ...
def lockf(__fd: FileDescriptorLike, __cmd: int, __len: int = 0, __start: int = 0, __whence: int = 0) -> Any: ...

View File

@ -22,9 +22,11 @@ else:
class Fraction(Rational):
@overload
def __new__(cls, numerator: int | Rational = 0, denominator: int | Rational | None = None) -> Self: ...
def __new__(
cls, numerator: int | Rational = 0, denominator: int | Rational | None = None, *, _normalize: bool = True
) -> Self: ...
@overload
def __new__(cls, __value: float | Decimal | str) -> Self: ...
def __new__(cls, __value: float | Decimal | str, *, _normalize: bool = True) -> Self: ...
@classmethod
def from_float(cls, f: float) -> Self: ...
@classmethod
@ -32,8 +34,6 @@ class Fraction(Rational):
def limit_denominator(self, max_denominator: int = 1000000) -> Fraction: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> tuple[int, int]: ...
if sys.version_info >= (3, 12):
def is_integer(self) -> bool: ...
@property
def numerator(a) -> int: ...

View File

@ -72,19 +72,9 @@ if sys.version_info >= (3, 8):
else:
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
if sys.version_info >= (3, 12):
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"],
Literal["__name__"],
Literal["__qualname__"],
Literal["__doc__"],
Literal["__annotations__"],
Literal["__type_params__"],
]
else:
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"]
]
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"]
]
WRAPPER_UPDATES: tuple[Literal["__dict__"]]
class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWapper]):
@ -97,32 +87,17 @@ class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWapper]):
class _Wrapper(Generic[_PWrapped, _RWrapped]):
def __call__(self, f: Callable[_PWrapper, _RWapper]) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
if sys.version_info >= (3, 12):
def update_wrapper(
wrapper: Callable[_PWrapper, _RWapper],
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__", "__type_params__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def wraps(
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__", "__type_params__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapper[_PWrapped, _RWrapped]: ...
else:
def update_wrapper(
wrapper: Callable[_PWrapper, _RWapper],
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def wraps(
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapper[_PWrapped, _RWrapped]: ...
def update_wrapper(
wrapper: Callable[_PWrapper, _RWapper],
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def wraps(
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapper[_PWrapped, _RWrapped]: ...
def total_ordering(cls: type[_T]) -> type[_T]: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ...

View File

@ -1,7 +1,7 @@
import _compression
import sys
import zlib
from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath
from _typeshed import ReadableBuffer, StrOrBytesPath, _BufferWithLen
from io import FileIO
from typing import Protocol, TextIO, overload
from typing_extensions import Literal, TypeAlias
@ -159,9 +159,9 @@ class _GzipReader(_compression.DecompressReader):
def __init__(self, fp: _ReadableFileobj) -> None: ...
if sys.version_info >= (3, 8):
def compress(data: SizedBuffer, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ...
def compress(data: _BufferWithLen, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ...
else:
def compress(data: SizedBuffer, compresslevel: int = 9) -> bytes: ...
def compress(data: _BufferWithLen, compresslevel: int = 9) -> bytes: ...
def decompress(data: ReadableBuffer) -> bytes: ...

View File

@ -1,5 +1,5 @@
import sys
from _typeshed import ReadableBuffer, SizedBuffer
from _typeshed import ReadableBuffer, _BufferWithLen
from collections.abc import Callable
from types import ModuleType
from typing import Any, AnyStr, overload
@ -46,4 +46,4 @@ class HMAC:
def compare_digest(__a: ReadableBuffer, __b: ReadableBuffer) -> bool: ...
@overload
def compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ...
def digest(key: SizedBuffer, msg: ReadableBuffer, digest: _DigestMod) -> bytes: ...
def digest(key: _BufferWithLen, msg: ReadableBuffer, digest: _DigestMod) -> bytes: ...

View File

@ -1,7 +1,7 @@
import subprocess
import sys
import time
from _typeshed import ReadableBuffer, SizedBuffer
from _typeshed import ReadableBuffer, _BufferWithLen
from builtins import list as _list # conflicts with a method named "list"
from collections.abc import Callable
from datetime import datetime
@ -155,7 +155,7 @@ class _Authenticator:
def __init__(self, mechinst: Callable[[bytes], bytes | bytearray | memoryview | str | None]) -> None: ...
def process(self, data: str) -> str: ...
def encode(self, inp: bytes | bytearray | memoryview) -> str: ...
def decode(self, inp: str | SizedBuffer) -> bytes: ...
def decode(self, inp: str | _BufferWithLen) -> bytes: ...
def Internaldate2tuple(resp: ReadableBuffer) -> time.struct_time | None: ...
def Int2AP(num: SupportsAbs[SupportsInt]) -> bytes: ...

View File

@ -598,25 +598,3 @@ def classify_class_attrs(cls: type) -> list[Attribute]: ...
if sys.version_info >= (3, 9):
class ClassFoundException(Exception): ...
if sys.version_info >= (3, 12):
class BufferFlags(enum.IntFlag):
SIMPLE: int
WRITABLE: int
FORMAT: int
ND: int
STRIDES: int
C_CONTIGUOUS: int
F_CONTIGUOUS: int
ANY_CONTIGUOUS: int
INDIRECT: int
CONTIG: int
CONTIG_RO: int
STRIDED: int
STRIDED_RO: int
RECORDS: int
RECORDS_RO: int
FULL: int
FULL_RO: int
READ: int
WRITE: int

View File

@ -1,4 +1,3 @@
import sys
from _typeshed import SupportsRead, SupportsWrite
from collections.abc import Callable
from typing import Any
@ -7,8 +6,6 @@ from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDeco
from .encoder import JSONEncoder as JSONEncoder
__all__ = ["dump", "dumps", "load", "loads", "JSONDecoder", "JSONDecodeError", "JSONEncoder"]
if sys.version_info >= (3, 12):
__all__ += ["AttrDict"]
def dumps(
obj: Any,
@ -62,9 +59,3 @@ def load(
**kwds: Any,
) -> Any: ...
def detect_encoding(b: bytes | bytearray) -> str: ... # undocumented
if sys.version_info >= (3, 12):
class AttrDict(dict[str, Any]):
def __getattr__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...

View File

@ -179,7 +179,7 @@ class SysLogHandler(Handler):
facility_names: ClassVar[dict[str, int]] # undocumented
priority_map: ClassVar[dict[str, str]] # undocumented
def __init__(
self, address: tuple[str, int] | str = ("localhost", 514), facility: str | int = 1, socktype: SocketKind | None = None
self, address: tuple[str, int] | str = ("localhost", 514), facility: int = 1, socktype: SocketKind | None = None
) -> None: ...
if sys.version_info >= (3, 11):
def createSocket(self) -> None: ...

View File

@ -112,10 +112,7 @@ def log1p(__x: _SupportsFloatOrIndex) -> float: ...
def log2(__x: _SupportsFloatOrIndex) -> float: ...
def modf(__x: _SupportsFloatOrIndex) -> tuple[float, float]: ...
if sys.version_info >= (3, 12):
def nextafter(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex, *, steps: SupportsIndex | None = None) -> float: ...
elif sys.version_info >= (3, 9):
if sys.version_info >= (3, 9):
def nextafter(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 8):
@ -133,10 +130,6 @@ def radians(__x: _SupportsFloatOrIndex) -> float: ...
def remainder(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
def sin(__x: _SupportsFloatOrIndex) -> float: ...
def sinh(__x: _SupportsFloatOrIndex) -> float: ...
if sys.version_info >= (3, 12):
def sumprod(__p: Iterable[float], __q: Iterable[float]) -> float: ...
def sqrt(__x: _SupportsFloatOrIndex) -> float: ...
def tan(__x: _SupportsFloatOrIndex) -> float: ...
def tanh(__x: _SupportsFloatOrIndex) -> float: ...

View File

@ -76,8 +76,6 @@ class mmap(Iterable[int], Sized):
def __iter__(self) -> Iterator[int]: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: Unused) -> None: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_NORMAL: int

View File

@ -55,11 +55,7 @@ class PurePath(PathLike[str]):
if sys.version_info >= (3, 9):
def is_relative_to(self, *other: StrPath) -> bool: ...
if sys.version_info >= (3, 12):
def match(self, path_pattern: str, *, case_sensitive: bool | None = None) -> bool: ...
else:
def match(self, path_pattern: str) -> bool: ...
def match(self, path_pattern: str) -> bool: ...
def relative_to(self, *other: StrPath) -> Self: ...
def with_name(self, name: str) -> Self: ...
if sys.version_info >= (3, 9):
@ -74,9 +70,6 @@ class PurePath(PathLike[str]):
if sys.version_info >= (3, 9) and sys.version_info < (3, 11):
def __class_getitem__(cls, type: Any) -> GenericAlias: ...
if sys.version_info >= (3, 12):
def with_segments(self, *args: StrPath) -> Self: ...
class PurePosixPath(PurePath): ...
class PureWindowsPath(PurePath): ...
@ -93,15 +86,8 @@ class Path(PurePath):
def stat(self) -> stat_result: ...
def chmod(self, mode: int) -> None: ...
if sys.version_info >= (3, 12):
def exists(self, *, follow_symlinks: bool = True) -> bool: ...
def glob(self, pattern: str, *, case_sensitive: bool | None = None) -> Generator[Self, None, None]: ...
def rglob(self, pattern: str, *, case_sensitive: bool | None = None) -> Generator[Self, None, None]: ...
else:
def exists(self) -> bool: ...
def glob(self, pattern: str) -> Generator[Self, None, None]: ...
def rglob(self, pattern: str) -> Generator[Self, None, None]: ...
def exists(self) -> bool: ...
def glob(self, pattern: str) -> Generator[Self, None, None]: ...
def is_dir(self) -> bool: ...
def is_file(self) -> bool: ...
def is_symlink(self) -> bool: ...
@ -109,9 +95,6 @@ class Path(PurePath):
def is_fifo(self) -> bool: ...
def is_block_device(self) -> bool: ...
def is_char_device(self) -> bool: ...
if sys.version_info >= (3, 12):
def is_junction(self) -> bool: ...
def iterdir(self) -> Generator[Self, None, None]: ...
def lchmod(self, mode: int) -> None: ...
def lstat(self) -> stat_result: ...
@ -176,10 +159,6 @@ class Path(PurePath):
# so it's safer to pretend they don't exist
def owner(self) -> str: ...
def group(self) -> str: ...
# This method does "exist" on Windows on <3.12, but always raises NotImplementedError
# On py312+, it works properly on Windows, as with all other platforms
if sys.platform != "win32" or sys.version_info >= (3, 12):
def is_mount(self) -> bool: ...
if sys.version_info >= (3, 9):
@ -192,6 +171,7 @@ class Path(PurePath):
def replace(self, target: str | PurePath) -> None: ...
def resolve(self, strict: bool = False) -> Self: ...
def rglob(self, pattern: str) -> Generator[Self, None, None]: ...
def rmdir(self) -> None: ...
def symlink_to(self, target: StrOrBytesPath, target_is_directory: bool = False) -> None: ...
if sys.version_info >= (3, 10):

View File

@ -168,10 +168,7 @@ class Pdb(Bdb, Cmd):
def find_function(funcname: str, filename: str) -> tuple[str, str, int] | None: ...
def main() -> None: ...
def help() -> None: ...
if sys.version_info < (3, 10):
def getsourcelines(obj: _SourceObjectType) -> tuple[list[str], int]: ...
def getsourcelines(obj: _SourceObjectType) -> tuple[list[str], int]: ...
def lasti2lineno(code: CodeType, lasti: int) -> int: ...
class _rstr(str):

View File

@ -103,8 +103,6 @@ if sys.version_info >= (3, 8):
def __init__(self, buffer: ReadableBuffer) -> None: ...
def raw(self) -> memoryview: ...
def release(self) -> None: ...
def __buffer__(self, __flags: int) -> memoryview: ...
def __release_buffer__(self, __buffer: memoryview) -> None: ...
_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None
def dump(
obj: Any,

View File

@ -34,8 +34,6 @@ __all__ = [
if sys.version_info >= (3, 9):
__all__ += ["randbytes"]
if sys.version_info >= (3, 12):
__all__ += ["binomialvariate"]
_T = TypeVar("_T")
@ -81,15 +79,8 @@ class Random(_random.Random):
def uniform(self, a: float, b: float) -> float: ...
def triangular(self, low: float = 0.0, high: float = 1.0, mode: float | None = None) -> float: ...
if sys.version_info >= (3, 12):
def binomialvariate(self, n: int = 1, p: float = 0.5) -> int: ...
def betavariate(self, alpha: float, beta: float) -> float: ...
if sys.version_info >= (3, 12):
def expovariate(self, lambd: float = 1.0) -> float: ...
else:
def expovariate(self, lambd: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...
if sys.version_info >= (3, 11):
def gauss(self, mu: float = 0.0, sigma: float = 1.0) -> float: ...
@ -126,8 +117,6 @@ expovariate = _inst.expovariate
vonmisesvariate = _inst.vonmisesvariate
gammavariate = _inst.gammavariate
gauss = _inst.gauss
if sys.version_info >= (3, 12):
binomialvariate = _inst.binomialvariate
betavariate = _inst.betavariate
paretovariate = _inst.paretovariate
weibullvariate = _inst.weibullvariate

View File

@ -87,46 +87,22 @@ else:
ignore_dangling_symlinks: bool = False,
) -> _PathReturn: ...
_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], str, Any], object]
_OnExcCallback: TypeAlias = Callable[[Callable[..., Any], str, Exception], object]
_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], Any, Any], object]
class _RmtreeType(Protocol):
avoids_symlink_attacks: bool
if sys.version_info >= (3, 12):
@overload
if sys.version_info >= (3, 11):
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: _OnErrorCallback | None = None,
ignore_errors: bool = ...,
onerror: _OnErrorCallback | None = ...,
*,
onexc: None = None,
dir_fd: int | None = None,
) -> None: ...
@overload
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: None = None,
*,
onexc: _OnExcCallback,
dir_fd: int | None = None,
) -> None: ...
elif sys.version_info >= (3, 11):
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: _OnErrorCallback | None = None,
*,
dir_fd: int | None = None,
dir_fd: int | None = ...,
) -> None: ...
else:
def __call__(
self, path: StrOrBytesPath, ignore_errors: bool = False, onerror: _OnErrorCallback | None = None
) -> None: ...
def __call__(self, path: StrOrBytesPath, ignore_errors: bool = ..., onerror: _OnErrorCallback | None = ...) -> None: ...
rmtree: _RmtreeType
@ -191,15 +167,7 @@ def register_archive_format(
name: str, function: Callable[[str, str], object], extra_args: None = None, description: str = ""
) -> None: ...
def unregister_archive_format(name: str) -> None: ...
if sys.version_info >= (3, 12):
def unpack_archive(
filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None, *, filter: str | None = None
) -> None: ...
else:
def unpack_archive(filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None) -> None: ...
def unpack_archive(filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None) -> None: ...
@overload
def register_unpack_format(
name: str,

View File

@ -1,6 +1,6 @@
import sys
from _socket import _Address as _SourceAddress
from _typeshed import ReadableBuffer, SizedBuffer
from _typeshed import ReadableBuffer, _BufferWithLen
from collections.abc import Sequence
from email.message import Message as _Message
from re import Pattern
@ -133,7 +133,7 @@ class SMTP:
self,
from_addr: str,
to_addrs: str | Sequence[str],
msg: SizedBuffer | str,
msg: _BufferWithLen | str,
mail_options: Sequence[str] = (),
rcpt_options: Sequence[str] = (),
) -> _SendErrs: ...

View File

@ -438,36 +438,6 @@ if sys.platform == "win32":
SIO_LOOPBACK_FAST_PATH as SIO_LOOPBACK_FAST_PATH,
SIO_RCVALL as SIO_RCVALL,
)
if sys.version_info >= (3, 12):
from _socket import (
IP_ADD_SOURCE_MEMBERSHIP as IP_ADD_SOURCE_MEMBERSHIP,
IP_BLOCK_SOURCE as IP_BLOCK_SOURCE,
IP_DROP_SOURCE_MEMBERSHIP as IP_DROP_SOURCE_MEMBERSHIP,
IP_PKTINFO as IP_PKTINFO,
IP_UNBLOCK_SOURCE as IP_UNBLOCK_SOURCE,
)
if sys.platform == "win32":
from _socket import (
HV_GUID_BROADCAST as HV_GUID_BROADCAST,
HV_GUID_CHILDREN as HV_GUID_CHILDREN,
HV_GUID_LOOPBACK as HV_GUID_LOOPBACK,
HV_GUID_PARENT as HV_GUID_PARENT,
HV_GUID_WILDCARD as HV_GUID_WILDCARD,
HV_GUID_ZERO as HV_GUID_ZERO,
HV_PROTOCOL_RAW as HV_PROTOCOL_RAW,
HVSOCKET_ADDRESS_FLAG_PASSTHRU as HVSOCKET_ADDRESS_FLAG_PASSTHRU,
HVSOCKET_CONNECT_TIMEOUT as HVSOCKET_CONNECT_TIMEOUT,
HVSOCKET_CONNECT_TIMEOUT_MAX as HVSOCKET_CONNECT_TIMEOUT_MAX,
HVSOCKET_CONNECTED_SUSPEND as HVSOCKET_CONNECTED_SUSPEND,
)
else:
from _socket import (
ETHERTYPE_ARP as ETHERTYPE_ARP,
ETHERTYPE_IP as ETHERTYPE_IP,
ETHERTYPE_IPV6 as ETHERTYPE_IPV6,
ETHERTYPE_VLAN as ETHERTYPE_VLAN,
)
# Re-exported from errno
EBADF: int
@ -519,8 +489,6 @@ class AddressFamily(IntEnum):
AF_LINK: int
if sys.platform != "darwin":
AF_BLUETOOTH: int
if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV: int
AF_INET = AddressFamily.AF_INET
AF_INET6 = AddressFamily.AF_INET6
@ -572,9 +540,6 @@ if sys.platform != "win32" or sys.version_info >= (3, 9):
if sys.platform != "darwin":
AF_BLUETOOTH = AddressFamily.AF_BLUETOOTH
if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV = AddressFamily.AF_HYPERV
class SocketKind(IntEnum):
SOCK_STREAM: int
SOCK_DGRAM: int

View File

@ -28,8 +28,6 @@ if sys.platform != "win32":
"UnixDatagramServer",
"UnixStreamServer",
]
if sys.version_info >= (3, 12):
__all__ += ["ForkingUnixStreamServer", "ForkingUnixDatagramServer"]
_RequestType: TypeAlias = _socket | tuple[bytes, _socket]
_AfUnixAddress: TypeAlias = str | ReadableBuffer # address acceptable for an AF_UNIX socket
@ -126,9 +124,6 @@ class ThreadingMixIn:
if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
if sys.version_info >= (3, 12):
class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer): ...
class ForkingUnixDatagramServer(ForkingMixIn, UnixDatagramServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...

View File

@ -114,15 +114,8 @@ if sys.version_info >= (3, 8):
def __rsub__(self, x2: float | NormalDist) -> NormalDist: ...
__rmul__ = __mul__
if sys.version_info >= (3, 12):
def correlation(
__x: Sequence[_Number], __y: Sequence[_Number], *, method: Literal["linear", "ranked"] = "linear"
) -> float: ...
elif sys.version_info >= (3, 10):
def correlation(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ...
if sys.version_info >= (3, 10):
def correlation(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ...
def covariance(__x: Sequence[_Number], __y: Sequence[_Number]) -> float: ...
class LinearRegression(NamedTuple):

View File

@ -321,7 +321,7 @@ if sys.version_info < (3, 9):
if sys.version_info >= (3, 8):
# Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
class UnraisableHookArgs(Protocol):
class UnraisableHookArgs:
exc_type: type[BaseException]
exc_value: BaseException | None
exc_traceback: TracebackType | None
@ -359,13 +359,3 @@ if sys.version_info < (3, 8):
# as part of the response to CVE-2020-10735
def set_int_max_str_digits(maxdigits: int) -> None: ...
def get_int_max_str_digits() -> int: ...
if sys.version_info >= (3, 12):
def getunicodeinternedsize() -> int: ...
def deactivate_stack_trampoline() -> None: ...
def is_stack_trampoline_active() -> bool: ...
# It always exists, but raises on non-linux platforms:
if sys.platform == "linux":
def activate_stack_trampoline(__backend: str) -> None: ...
else:
def activate_stack_trampoline(__backend: str) -> NoReturn: ...

View File

@ -33,51 +33,7 @@ template: str
_StrMode: TypeAlias = Literal["r", "w", "a", "x", "r+", "w+", "a+", "x+", "rt", "wt", "at", "xt", "r+t", "w+t", "a+t", "x+t"]
_BytesMode: TypeAlias = Literal["rb", "wb", "ab", "xb", "r+b", "w+b", "a+b", "x+b"]
if sys.version_info >= (3, 12):
@overload
def NamedTemporaryFile(
mode: _StrMode,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
delete_on_close: bool = True,
) -> _TemporaryFileWrapper[str]: ...
@overload
def NamedTemporaryFile(
mode: _BytesMode = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
delete_on_close: bool = True,
) -> _TemporaryFileWrapper[bytes]: ...
@overload
def NamedTemporaryFile(
mode: str = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
delete: bool = True,
*,
errors: str | None = None,
delete_on_close: bool = True,
) -> _TemporaryFileWrapper[Any]: ...
elif sys.version_info >= (3, 8):
if sys.version_info >= (3, 8):
@overload
def NamedTemporaryFile(
mode: _StrMode,
@ -229,11 +185,7 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
file: IO[AnyStr] # io.TextIOWrapper, io.BufferedReader or io.BufferedWriter
name: str
delete: bool
if sys.version_info >= (3, 12):
def __init__(self, file: IO[AnyStr], name: str, delete: bool = True, delete_on_close: bool = True) -> None: ...
else:
def __init__(self, file: IO[AnyStr], name: str, delete: bool = True) -> None: ...
def __init__(self, file: IO[AnyStr], name: str, delete: bool = True) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
def __getattr__(self, name: str) -> Any: ...
@ -473,28 +425,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase):
class TemporaryDirectory(Generic[AnyStr]):
name: AnyStr
if sys.version_info >= (3, 12):
@overload
def __init__(
self: TemporaryDirectory[str],
suffix: str | None = None,
prefix: str | None = None,
dir: StrPath | None = None,
ignore_cleanup_errors: bool = False,
*,
delete: bool = True,
) -> None: ...
@overload
def __init__(
self: TemporaryDirectory[bytes],
suffix: bytes | None = None,
prefix: bytes | None = None,
dir: BytesPath | None = None,
ignore_cleanup_errors: bool = False,
*,
delete: bool = True,
) -> None: ...
elif sys.version_info >= (3, 10):
if sys.version_info >= (3, 10):
@overload
def __init__(
self: TemporaryDirectory[str],

View File

@ -37,9 +37,6 @@ if sys.version_info >= (3, 8):
if sys.version_info >= (3, 10):
__all__ += ["getprofile", "gettrace"]
if sys.version_info >= (3, 12):
__all__ += ["setprofile_all_threads", "settrace_all_threads"]
_profile_hook: ProfileFunction | None
def active_count() -> int: ...
@ -56,10 +53,6 @@ if sys.version_info >= (3, 8):
def settrace(func: TraceFunction) -> None: ...
def setprofile(func: ProfileFunction | None) -> None: ...
if sys.version_info >= (3, 12):
def setprofile_all_threads(func: ProfileFunction | None) -> None: ...
def settrace_all_threads(func: TraceFunction) -> None: ...
if sys.version_info >= (3, 10):
def gettrace() -> TraceFunction | None: ...
def getprofile() -> ProfileFunction | None: ...

View File

@ -17,7 +17,7 @@ from importlib.machinery import ModuleSpec
# pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping
from typing import Any, ClassVar, Generic, Mapping, Protocol, TypeVar, overload # noqa: Y022
from typing_extensions import Literal, ParamSpec, TypeVarTuple, final
from typing_extensions import Literal, ParamSpec, final
__all__ = [
"FunctionType",
@ -94,8 +94,6 @@ class FunctionType:
if sys.version_info >= (3, 10):
@property
def __builtins__(self) -> dict[str, Any]: ...
if sys.version_info >= (3, 12):
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
__module__: str
def __init__(

View File

@ -136,32 +136,14 @@ Any = object()
@_final
class TypeVar:
@property
def __name__(self) -> str: ...
@property
def __bound__(self) -> Any | None: ...
@property
def __constraints__(self) -> tuple[Any, ...]: ...
@property
def __covariant__(self) -> bool: ...
@property
def __contravariant__(self) -> bool: ...
if sys.version_info >= (3, 12):
@property
def __infer_variance__(self) -> bool: ...
def __init__(
self,
name: str,
*constraints: Any,
bound: Any | None = None,
covariant: bool = False,
contravariant: bool = False,
infer_variance: bool = False,
) -> None: ...
else:
def __init__(
self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False
) -> None: ...
__name__: str
__bound__: Any | None
__constraints__: tuple[Any, ...]
__covariant__: bool
__contravariant__: bool
def __init__(
self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False
) -> None: ...
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
@ -211,55 +193,30 @@ if sys.version_info >= (3, 11):
NotRequired: _SpecialForm
LiteralString: _SpecialForm
@_final
class TypeVarTuple:
@property
def __name__(self) -> str: ...
__name__: str
def __init__(self, name: str) -> None: ...
def __iter__(self) -> Any: ...
def __typing_subst__(self, arg: Never) -> Never: ...
def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ...
if sys.version_info >= (3, 10):
@_final
class ParamSpecArgs:
@property
def __origin__(self) -> ParamSpec: ...
__origin__: ParamSpec
def __init__(self, origin: ParamSpec) -> None: ...
@_final
class ParamSpecKwargs:
@property
def __origin__(self) -> ParamSpec: ...
__origin__: ParamSpec
def __init__(self, origin: ParamSpec) -> None: ...
@_final
class ParamSpec:
@property
def __name__(self) -> str: ...
@property
def __bound__(self) -> Any | None: ...
@property
def __covariant__(self) -> bool: ...
@property
def __contravariant__(self) -> bool: ...
if sys.version_info >= (3, 12):
@property
def __infer_variance__(self) -> bool: ...
def __init__(
self,
name: str,
*,
bound: Any | None = None,
contravariant: bool = False,
covariant: bool = False,
infer_variance: bool = False,
) -> None: ...
else:
def __init__(
self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False
) -> None: ...
__name__: str
__bound__: Any | None
__covariant__: bool
__contravariant__: bool
def __init__(
self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False
) -> None: ...
@property
def args(self) -> ParamSpecArgs: ...
@property
@ -276,7 +233,7 @@ if sys.version_info >= (3, 10):
class NewType:
def __init__(self, name: str, tp: Any) -> None: ...
def __call__(self, __x: _T) -> _T: ...
def __call__(self, x: _T) -> _T: ...
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
__supertype__: type
@ -771,7 +728,7 @@ class TextIO(IO[str]):
@abstractmethod
def __enter__(self) -> TextIO: ...
ByteString: typing_extensions.TypeAlias = bytes | bytearray | memoryview
class ByteString(Sequence[int], metaclass=ABCMeta): ...
# Functions
@ -843,21 +800,18 @@ if sys.version_info >= (3, 11):
class NamedTuple(tuple[Any, ...]):
if sys.version_info < (3, 8):
_field_types: ClassVar[collections.OrderedDict[str, type]]
_field_types: collections.OrderedDict[str, type]
elif sys.version_info < (3, 9):
_field_types: ClassVar[dict[str, type]]
_field_defaults: ClassVar[dict[str, Any]]
_fields: ClassVar[tuple[str, ...]]
# __orig_bases__ sometimes exists on <3.12, but not consistently
# So we only add it to the stub on 3.12+.
if sys.version_info >= (3, 12):
__orig_bases__: ClassVar[tuple[Any, ...]]
_field_types: dict[str, type]
_field_defaults: dict[str, Any]
_fields: tuple[str, ...]
_source: str
@overload
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ...
@overload
def __init__(self, typename: str, fields: None = None, **kwargs: Any) -> None: ...
@classmethod
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...
if sys.version_info >= (3, 8):
def _asdict(self) -> dict[str, Any]: ...
else:
@ -873,10 +827,6 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
if sys.version_info >= (3, 9):
__required_keys__: ClassVar[frozenset[str]]
__optional_keys__: ClassVar[frozenset[str]]
# __orig_bases__ sometimes exists on <3.12, but not consistently,
# so we only add it to the stub on 3.12+
if sys.version_info >= (3, 12):
__orig_bases__: ClassVar[tuple[Any, ...]]
def copy(self) -> typing_extensions.Self: ...
# Using Never so that only calls using mypy plugin hook that specialize the signature
# can go through.
@ -923,26 +873,3 @@ if sys.version_info >= (3, 10):
def is_typeddict(tp: object) -> bool: ...
def _type_repr(obj: object) -> str: ...
if sys.version_info >= (3, 12):
def override(__arg: _F) -> _F: ...
@_final
class TypeAliasType:
def __init__(
self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()
) -> None: ...
@property
def __value__(self) -> Any: ...
@property
def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ...
@property
def __parameters__(self) -> tuple[Any, ...]: ...
@property
def __name__(self) -> str: ...
# It's writable on types, but not on instances of TypeAliasType.
@property
def __module__(self) -> str | None: ... # type: ignore[override]
def __getitem__(self, parameters: Any) -> Any: ...
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...

View File

@ -22,14 +22,9 @@ from typing import ( # noqa: Y022,Y039
DefaultDict as DefaultDict,
Deque as Deque,
Mapping,
NewType as NewType,
NoReturn as NoReturn,
Sequence,
SupportsAbs as SupportsAbs,
SupportsBytes as SupportsBytes,
SupportsComplex as SupportsComplex,
SupportsFloat as SupportsFloat,
SupportsInt as SupportsInt,
SupportsRound as SupportsRound,
Text as Text,
Type as Type,
_Alias,
@ -44,7 +39,6 @@ if sys.version_info >= (3, 9):
__all__ = [
"Any",
"Buffer",
"ClassVar",
"Concatenate",
"Final",
@ -72,12 +66,6 @@ __all__ = [
"OrderedDict",
"TypedDict",
"SupportsIndex",
"SupportsAbs",
"SupportsRound",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsInt",
"Annotated",
"assert_never",
"assert_type",
@ -96,7 +84,6 @@ __all__ = [
"runtime_checkable",
"Text",
"TypeAlias",
"TypeAliasType",
"TypeGuard",
"TYPE_CHECKING",
"Never",
@ -106,7 +93,6 @@ __all__ = [
"clear_overloads",
"get_args",
"get_origin",
"get_original_bases",
"get_overloads",
"get_type_hints",
]
@ -148,7 +134,6 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
__required_keys__: ClassVar[frozenset[str]]
__optional_keys__: ClassVar[frozenset[str]]
__total__: ClassVar[bool]
__orig_bases__: ClassVar[tuple[Any, ...]]
def copy(self) -> Self: ...
# Using Never so that only calls using mypy plugin hook that specialize the signature
# can go through.
@ -198,11 +183,10 @@ class SupportsIndex(Protocol, metaclass=abc.ABCMeta):
@abc.abstractmethod
def __index__(self) -> int: ...
# New and changed things in 3.10
# New things in 3.10
if sys.version_info >= (3, 10):
from typing import (
Concatenate as Concatenate,
NewType as NewType,
ParamSpecArgs as ParamSpecArgs,
ParamSpecKwargs as ParamSpecKwargs,
TypeAlias as TypeAlias,
@ -210,16 +194,12 @@ if sys.version_info >= (3, 10):
is_typeddict as is_typeddict,
)
else:
@final
class ParamSpecArgs:
@property
def __origin__(self) -> ParamSpec: ...
__origin__: ParamSpec
def __init__(self, origin: ParamSpec) -> None: ...
@final
class ParamSpecKwargs:
@property
def __origin__(self) -> ParamSpec: ...
__origin__: ParamSpec
def __init__(self, origin: ParamSpec) -> None: ...
Concatenate: _SpecialForm
@ -227,11 +207,6 @@ else:
TypeGuard: _SpecialForm
def is_typeddict(tp: object) -> bool: ...
class NewType:
def __init__(self, name: str, tp: Any) -> None: ...
def __call__(self, __x: _T) -> _T: ...
__supertype__: type
# New things in 3.11
# NamedTuples are not new, but the ability to create generic NamedTuples is new in 3.11
if sys.version_info >= (3, 11):
@ -276,12 +251,12 @@ else:
class NamedTuple(tuple[Any, ...]):
if sys.version_info < (3, 8):
_field_types: ClassVar[collections.OrderedDict[str, type]]
_field_types: collections.OrderedDict[str, type]
elif sys.version_info < (3, 9):
_field_types: ClassVar[dict[str, type]]
_field_defaults: ClassVar[dict[str, Any]]
_fields: ClassVar[tuple[str, ...]]
__orig_bases__: ClassVar[tuple[Any, ...]]
_field_types: dict[str, type]
_field_defaults: dict[str, Any]
_fields: tuple[str, ...]
_source: str
@overload
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]] = ...) -> None: ...
@overload
@ -297,24 +272,16 @@ else:
# New things in 3.xx
# The `default` parameter was added to TypeVar, ParamSpec, and TypeVarTuple (PEP 696)
# The `infer_variance` parameter was added to TypeVar in 3.12 (PEP 695)
# The `infer_variance` parameter was added to TypeVar (PEP 695)
# typing_extensions.override (PEP 698)
@final
class TypeVar:
@property
def __name__(self) -> str: ...
@property
def __bound__(self) -> Any | None: ...
@property
def __constraints__(self) -> tuple[Any, ...]: ...
@property
def __covariant__(self) -> bool: ...
@property
def __contravariant__(self) -> bool: ...
@property
def __infer_variance__(self) -> bool: ...
@property
def __default__(self) -> Any | None: ...
__name__: str
__bound__: Any | None
__constraints__: tuple[Any, ...]
__covariant__: bool
__contravariant__: bool
__default__: Any | None
def __init__(
self,
name: str,
@ -333,18 +300,11 @@ class TypeVar:
@final
class ParamSpec:
@property
def __name__(self) -> str: ...
@property
def __bound__(self) -> Any | None: ...
@property
def __covariant__(self) -> bool: ...
@property
def __contravariant__(self) -> bool: ...
@property
def __infer_variance__(self) -> bool: ...
@property
def __default__(self) -> Any | None: ...
__name__: str
__bound__: type[Any] | None
__covariant__: bool
__contravariant__: bool
__default__: type[Any] | None
def __init__(
self,
name: str,
@ -361,48 +321,30 @@ class ParamSpec:
@final
class TypeVarTuple:
@property
def __name__(self) -> str: ...
@property
def __default__(self) -> Any | None: ...
__name__: str
__default__: Any | None
def __init__(self, name: str, *, default: Any | None = None) -> None: ...
def __iter__(self) -> Any: ... # Unpack[Self]
def override(__arg: _F) -> _F: ...
def deprecated(__msg: str, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> Callable[[_T], _T]: ...
if sys.version_info >= (3, 12):
from collections.abc import Buffer as Buffer
from types import get_original_bases as get_original_bases
from typing import TypeAliasType as TypeAliasType, override as override
else:
def override(__arg: _F) -> _F: ...
def get_original_bases(__cls: type) -> tuple[Any, ...]: ...
@final
class TypeAliasType:
def __init__(
self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()
) -> None: ...
@property
def __value__(self) -> Any: ...
@property
def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ...
@property
def __parameters__(self) -> tuple[Any, ...]: ...
@property
def __name__(self) -> str: ...
# It's writable on types, but not on instances of TypeAliasType.
@property
def __module__(self) -> str | None: ... # type: ignore[override]
def __getitem__(self, parameters: Any) -> Any: ...
if sys.version_info >= (3, 10):
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
# PEP 695
@final
class TypeAliasType:
def __new__(
cls,
name: str,
value: Any,
*,
type_params: tuple[Any, ...] | None = None,
) -> TypeAliasType: ...
def __or__(self, other: Any) -> Any: ...
__name__: str
__parameters__: tuple[Any, ...] | None
__value__: Any
@runtime_checkable
class Buffer(Protocol):
# Not actually a Protocol at runtime; see
# https://github.com/python/typeshed/issues/10224 for why we're defining it this way
def __buffer__(self, __flags: int) -> memoryview: ...
# PEP 705
ReadOnly: _SpecialForm

View File

@ -41,7 +41,7 @@ _P = ParamSpec("_P")
ProxyTypes: tuple[type[Any], ...]
class WeakMethod(ref[_CallableT], Generic[_CallableT]):
def __new__(cls, meth: _CallableT, callback: Callable[[Self], object] | None = None) -> Self: ...
def __new__(cls, meth: _CallableT, callback: Callable[[_CallableT], object] | None = None) -> Self: ...
def __call__(self) -> _CallableT | None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...

View File

@ -2,7 +2,7 @@ import gzip
import http.client
import sys
import time
from _typeshed import ReadableBuffer, SizedBuffer, SupportsRead, SupportsWrite
from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite, _BufferWithLen
from collections.abc import Callable, Iterable, Mapping
from datetime import datetime
from io import BytesIO
@ -236,20 +236,20 @@ class Transport:
def __init__(self, use_datetime: bool = False, use_builtin_types: bool = False) -> None: ...
def request(
self, host: _HostType, handler: str, request_body: SizedBuffer, verbose: bool = False
self, host: _HostType, handler: str, request_body: _BufferWithLen, verbose: bool = False
) -> tuple[_Marshallable, ...]: ...
def single_request(
self, host: _HostType, handler: str, request_body: SizedBuffer, verbose: bool = False
self, host: _HostType, handler: str, request_body: _BufferWithLen, verbose: bool = False
) -> tuple[_Marshallable, ...]: ...
def getparser(self) -> tuple[ExpatParser, Unmarshaller]: ...
def get_host_info(self, host: _HostType) -> tuple[str, list[tuple[str, str]], dict[str, str]]: ...
def make_connection(self, host: _HostType) -> http.client.HTTPConnection: ...
def close(self) -> None: ...
def send_request(
self, host: _HostType, handler: str, request_body: SizedBuffer, debug: bool
self, host: _HostType, handler: str, request_body: _BufferWithLen, debug: bool
) -> http.client.HTTPConnection: ...
def send_headers(self, connection: http.client.HTTPConnection, headers: list[tuple[str, str]]) -> None: ...
def send_content(self, connection: http.client.HTTPConnection, request_body: SizedBuffer) -> None: ...
def send_content(self, connection: http.client.HTTPConnection, request_body: _BufferWithLen) -> None: ...
def parse_response(self, response: http.client.HTTPResponse) -> tuple[_Marshallable, ...]: ...
class SafeTransport(Transport):

View File

@ -1,6 +1,6 @@
import io
import sys
from _typeshed import SizedBuffer, StrOrBytesPath, StrPath
from _typeshed import StrOrBytesPath, StrPath, _BufferWithLen
from collections.abc import Callable, Iterable, Iterator
from os import PathLike
from types import TracebackType
@ -179,7 +179,7 @@ class ZipFile:
def writestr(
self,
zinfo_or_arcname: str | ZipInfo,
data: SizedBuffer | str,
data: _BufferWithLen | str,
compress_type: int | None = None,
compresslevel: int | None = None,
) -> None: ...

View File

@ -17,10 +17,8 @@ class zipimporter:
else:
def __init__(self, path: StrOrBytesPath) -> None: ...
if sys.version_info < (3, 12):
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ... # undocumented
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ... # undocumented
def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ...
def get_code(self, fullname: str) -> CodeType: ...
def get_data(self, pathname: str) -> bytes: ...
def get_filename(self, fullname: str) -> str: ...

View File

@ -6,6 +6,7 @@ from typing_extensions import Final, ParamSpec, SupportsIndex, TypeAlias
from pyscreeze import (
center as center,
grab as grab,
locate as locate,
locateAll as locateAll,
locateAllOnScreen as locateAllOnScreen,
@ -67,9 +68,6 @@ def getPointOnLine(x1: float, y1: float, x2: float, y2: float, n: float) -> tupl
def linear(n: float) -> float: ...
def position(x: int | None = None, y: int | None = None) -> Point: ...
def size() -> Size: ...
resolution = size
def onScreen(x: _NormalizeableXArg | None, y: SupportsInt | None = None) -> bool: ...
def mouseDown(
x: _NormalizeableXArg | None = None,
@ -237,9 +235,6 @@ def typewrite(
write = typewrite
def hotkey(*args: str, logScreenshot: bool | None = None, interval: float = 0.0) -> None: ...
shortcut = hotkey
def failSafeCheck() -> None: ...
def displayMousePosition(xOffset: float = 0, yOffset: float = 0) -> None: ...
def sleep(seconds: float) -> None: ...

View File

@ -41,7 +41,7 @@ class PyScreezeException(Exception): ...
class ImageNotFoundException(PyScreezeException): ...
# _locateAll_opencv
def requiresPyGetWindow(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ...
def requiresPillow(wrappedFunction: Callable[_P, _R]) -> Callable[_P, _R]: ...
@overload
def locate(
needleImage: str | Image.Image | _Mat,
@ -142,8 +142,6 @@ def locateCenterOnScreen(
step: int = 1,
confidence: None = None,
) -> Point | None: ...
def locateOnScreenNear(image: str | Image.Image | _Mat, x: int, y: int) -> Box: ...
def locateCenterOnScreenNear(image: str | Image.Image | _Mat, x: int, y: int) -> Point | None: ...
# _locateAll_opencv
@overload
@ -178,6 +176,8 @@ def pixelMatchesColor(
def pixel(x: int, y: int) -> tuple[int, int, int]: ...
def screenshot(imageFilename: StrOrBytesPath | None = None, region: tuple[int, int, int, int] | None = None) -> Image.Image: ...
grab = screenshot
# _locateAll_opencv
@overload
def locateAll(

View File

@ -1,6 +1,7 @@
from collections.abc import Callable, Iterable, Iterator, Mapping
from re import Pattern
from typing import Any, TypeVar, overload
from typing_extensions import TypeAlias
from . import resolver as resolver # Help mypy a bit; this is implied by loader and dumper
from .constructor import BaseConstructor
@ -19,6 +20,9 @@ from .representer import BaseRepresenter
from .resolver import BaseResolver
from .tokens import *
# FIXME: the functions really return str if encoding is None, otherwise bytes. Waiting for python/mypy#5621
_Yaml: TypeAlias = Any
_T = TypeVar("_T")
_Constructor = TypeVar("_Constructor", bound=BaseConstructor)
_Representer = TypeVar("_Representer", bound=BaseRepresenter)
@ -54,7 +58,6 @@ def serialize_all(
nodes,
stream: _WriteStream[Any],
Dumper=...,
*,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
@ -71,41 +74,6 @@ def serialize_all(
nodes,
stream: None = None,
Dumper=...,
*,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
) -> str: ...
@overload
def serialize_all(
nodes,
stream: None = None,
Dumper=...,
*,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
) -> bytes: ...
@overload
def serialize(
node,
stream: _WriteStream[Any],
Dumper=...,
*,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
@ -116,6 +84,23 @@ def serialize(
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
) -> _Yaml: ...
@overload
def serialize(
node,
stream: _WriteStream[Any],
Dumper=...,
*,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
) -> None: ...
@overload
def serialize(
@ -123,40 +108,22 @@ def serialize(
stream: None = None,
Dumper=...,
*,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
) -> str: ...
@overload
def serialize(
node,
stream: None = None,
Dumper=...,
*,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
) -> bytes: ...
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
) -> _Yaml: ...
@overload
def dump_all(
documents: Iterable[Any],
stream: _WriteStream[Any],
Dumper=...,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
@ -176,47 +143,6 @@ def dump_all(
documents: Iterable[Any],
stream: None = None,
Dumper=...,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> str: ...
@overload
def dump_all(
documents: Iterable[Any],
stream: None = None,
Dumper=...,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> bytes: ...
@overload
def dump(
data: Any,
stream: _WriteStream[Any],
Dumper=...,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
@ -230,6 +156,26 @@ def dump(
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> _Yaml: ...
@overload
def dump(
data: Any,
stream: _WriteStream[Any],
Dumper=...,
*,
default_style: str | None = ...,
default_flow_style: bool | None = ...,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
sort_keys: bool = ...,
) -> None: ...
@overload
def dump(
@ -237,154 +183,96 @@ def dump(
stream: None = None,
Dumper=...,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> str: ...
@overload
def dump(
data: Any,
stream: None = None,
Dumper=...,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> bytes: ...
default_style: str | None = ...,
default_flow_style: bool | None = ...,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
sort_keys: bool = ...,
) -> _Yaml: ...
@overload
def safe_dump_all(
documents: Iterable[Any],
stream: _WriteStream[Any],
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str | None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
default_style: str | None = ...,
default_flow_style: bool | None = ...,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
sort_keys: bool = ...,
) -> None: ...
@overload
def safe_dump_all(
documents: Iterable[Any],
stream: None = None,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> str: ...
@overload
def safe_dump_all(
documents: Iterable[Any],
stream: None = None,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> bytes: ...
default_style: str | None = ...,
default_flow_style: bool | None = ...,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
sort_keys: bool = ...,
) -> _Yaml: ...
@overload
def safe_dump(
data: Any,
stream: _WriteStream[Any],
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str | None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
default_style: str | None = ...,
default_flow_style: bool | None = ...,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
sort_keys: bool = ...,
) -> None: ...
@overload
def safe_dump(
data: Any,
stream: None = None,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: None = None,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> str: ...
@overload
def safe_dump(
data: Any,
stream: None = None,
*,
default_style: str | None = None,
default_flow_style: bool | None = False,
canonical: bool | None = None,
indent: int | None = None,
width: int | _Inf | None = None,
allow_unicode: bool | None = None,
line_break: str | None = None,
encoding: str,
explicit_start: bool | None = None,
explicit_end: bool | None = None,
version: tuple[int, int] | None = None,
tags: Mapping[str, str] | None = None,
sort_keys: bool = True,
) -> bytes: ...
default_style: str | None = ...,
default_flow_style: bool | None = ...,
canonical: bool | None = ...,
indent: int | None = ...,
width: int | _Inf | None = ...,
allow_unicode: bool | None = ...,
line_break: str | None = ...,
encoding: str | None = ...,
explicit_start: bool | None = ...,
explicit_end: bool | None = ...,
version: tuple[int, int] | None = ...,
tags: Mapping[str, str] | None = ...,
sort_keys: bool = ...,
) -> _Yaml: ...
def add_implicit_resolver(
tag: str,
regexp: Pattern[str],

View File

@ -1,5 +1,5 @@
import sys
from _typeshed import BytesPath, FileDescriptorOrPath, GenericPath, ReadableBuffer, StrOrBytesPath, StrPath
from _typeshed import FileDescriptorOrPath, GenericPath, ReadableBuffer, StrOrBytesPath
from asyncio.events import AbstractEventLoop
from collections.abc import Sequence
from os import _ScandirIterator, stat_result
@ -26,9 +26,6 @@ async def rename(
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> None: ...
async def renames(
old: StrOrBytesPath, new: StrOrBytesPath, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def replace(
src: StrOrBytesPath,
dst: StrOrBytesPath,
@ -41,37 +38,12 @@ async def replace(
async def remove(
path: StrOrBytesPath, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def unlink(
path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def mkdir(
path: StrOrBytesPath, mode: int = 511, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def makedirs(
name: StrOrBytesPath, mode: int = 511, exist_ok: bool = False, *, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def link(
src: StrOrBytesPath,
dst: StrOrBytesPath,
*,
src_dir_fd: int | None = ...,
dst_dir_fd: int | None = ...,
follow_symlinks: bool = ...,
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> None: ...
async def symlink(
src: StrOrBytesPath,
dst: StrOrBytesPath,
target_is_directory: bool = ...,
*,
dir_fd: int | None = ...,
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> None: ...
async def readlink(
path: AnyStr, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> AnyStr: ...
async def rmdir(
path: StrOrBytesPath, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
@ -84,12 +56,6 @@ async def scandir(path: int, *, loop: AbstractEventLoop | None = ..., executor:
async def scandir(
path: GenericPath[AnyStr], *, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> _ScandirIterator[AnyStr]: ...
@overload
async def listdir(path: StrPath | None, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> list[str]: ...
@overload
async def listdir(path: BytesPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> list[bytes]: ...
@overload
async def listdir(path: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> list[str]: ...
if sys.platform != "win32":
@overload

View File

@ -1,5 +1,5 @@
version = "2.11.*"
requires = ["types-pytz", "types-setuptools"]
requires = ["types-pytz"]
obsolete_since = "2.12.1" # Released on 2023-02-28
partial_stub = true

View File

@ -1,9 +1,8 @@
import abc
from _typeshed import Incomplete
from distutils.cmd import Command as _Command
from typing import Any
from setuptools._distutils.cmd import Command as _Command
def listify_value(arg, split: Incomplete | None = None): ...
class Command(_Command, metaclass=abc.ABCMeta):

View File

@ -1,4 +1,4 @@
version = "4.20.*"
version = "4.19.*"
partial_stub = true
[tool.stubtest]

View File

@ -1,5 +1,4 @@
version = "1.15.*"
requires = ["types-setuptools"]
[tool.stubtest]
# linux and darwin are mostly equivalent, except for a single `RTLD_DEEPBIND` variable

View File

@ -1,3 +1,4 @@
import distutils.core
import sys
import types
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
@ -6,7 +7,6 @@ from typing import Any, TypeVar, overload
from typing_extensions import Literal, TypeAlias
import _cffi_backend
from setuptools._distutils.extension import Extension
_T = TypeVar("_T")
@ -93,7 +93,7 @@ class FFI:
def set_source_pkgconfig(
self, module_name: str, pkgconfig_libs: list[str], source: str, source_extension: str = ".c", **kwds: Any
) -> None: ...
def distutils_extension(self, tmpdir: str = "build", verbose: bool = True) -> Extension: ...
def distutils_extension(self, tmpdir: str = "build", verbose: bool = True) -> distutils.core.Extension: ...
def emit_c_code(self, filename: str) -> None: ...
def emit_python_code(self, filename: str) -> None: ...
def compile(self, tmpdir: str = ".", verbose: int = 0, target: str | None = None, debug: bool | None = None) -> str: ...

View File

@ -0,0 +1,6 @@
version = "5.0.*"
obsolete_since = "5.1.0" # Released on 2022-12-01
partial_stub = true
[tool.stubtest]
ignore_missing_stub = true

View File

@ -0,0 +1,16 @@
from typing_extensions import TypedDict
from .universaldetector import UniversalDetector as UniversalDetector, _FinalResultType, _IntermediateResultType
from .version import VERSION as VERSION, __version__ as __version__
# unused in this module, but imported in multiple submodules
class _LangModelType(TypedDict): # noqa: Y049
char_to_order_map: tuple[int, ...]
precedence_matrix: tuple[int, ...]
typical_positive_ratio: float
keep_english_letter: bool
charset_name: str
language: str
def detect(byte_str: bytes | bytearray) -> _FinalResultType: ...
def detect_all(byte_str: bytes | bytearray, ignore_threshold: bool = False) -> list[_IntermediateResultType]: ...

View File

@ -0,0 +1,39 @@
class InputState:
PURE_ASCII: int
ESC_ASCII: int
HIGH_BYTE: int
class LanguageFilter:
CHINESE_SIMPLIFIED: int
CHINESE_TRADITIONAL: int
JAPANESE: int
KOREAN: int
NON_CJK: int
ALL: int
CHINESE: int
CJK: int
class ProbingState:
DETECTING: int
FOUND_IT: int
NOT_ME: int
class MachineState:
START: int
ERROR: int
ITS_ME: int
class SequenceLikelihood:
NEGATIVE: int
UNLIKELY: int
LIKELY: int
POSITIVE: int
@classmethod
def get_num_categories(cls) -> int: ...
class CharacterCategory:
UNDEFINED: int
LINE_BREAK: int
SYMBOL: int
DIGIT: int
CONTROL: int

View File

@ -0,0 +1,7 @@
from . import _LangModelType
Latin5_BulgarianCharToOrderMap: tuple[int, ...]
win1251BulgarianCharToOrderMap: tuple[int, ...]
BulgarianLangModel: tuple[int, ...]
Latin5BulgarianModel: _LangModelType
Win1251BulgarianModel: _LangModelType

View File

@ -0,0 +1,15 @@
from . import _LangModelType
KOI8R_char_to_order_map: tuple[int, ...]
win1251_char_to_order_map: tuple[int, ...]
latin5_char_to_order_map: tuple[int, ...]
macCyrillic_char_to_order_map: tuple[int, ...]
IBM855_char_to_order_map: tuple[int, ...]
IBM866_char_to_order_map: tuple[int, ...]
RussianLangModel: tuple[int, ...]
Koi8rModel: _LangModelType
Win1251CyrillicModel: _LangModelType
Latin5CyrillicModel: _LangModelType
MacCyrillicModel: _LangModelType
Ibm866Model: _LangModelType
Ibm855Model: _LangModelType

View File

@ -0,0 +1,7 @@
from . import _LangModelType
Latin7_char_to_order_map: tuple[int, ...]
win1253_char_to_order_map: tuple[int, ...]
GreekLangModel: tuple[int, ...]
Latin7GreekModel: _LangModelType
Win1253GreekModel: _LangModelType

View File

@ -0,0 +1,5 @@
from . import _LangModelType
WIN1255_CHAR_TO_ORDER_MAP: tuple[int, ...]
HEBREW_LANG_MODEL: tuple[int, ...]
Win1255HebrewModel: _LangModelType

View File

@ -0,0 +1,7 @@
from . import _LangModelType
Latin2_HungarianCharToOrderMap: tuple[int, ...]
win1250HungarianCharToOrderMap: tuple[int, ...]
HungarianLangModel: tuple[int, ...]
Latin2HungarianModel: _LangModelType
Win1250HungarianModel: _LangModelType

View File

@ -0,0 +1,5 @@
from . import _LangModelType
TIS620CharToOrderMap: tuple[int, ...]
ThaiLangModel: tuple[int, ...]
TIS620ThaiModel: _LangModelType

View File

@ -0,0 +1,5 @@
from . import _LangModelType
Latin5_TurkishCharToOrderMap: tuple[int, ...]
TurkishLangModel: tuple[int, ...]
Latin5TurkishModel: _LangModelType

View File

@ -0,0 +1,29 @@
from logging import Logger
from re import Pattern
from typing_extensions import TypedDict
class _FinalResultType(TypedDict):
encoding: str
confidence: float
language: str
class _IntermediateResultType(TypedDict):
encoding: str | None
confidence: float
language: str | None
class UniversalDetector:
MINIMUM_THRESHOLD: float
HIGH_BYTE_DETECTOR: Pattern[bytes]
ESC_DETECTOR: Pattern[bytes]
WIN_BYTE_DETECTOR: Pattern[bytes]
ISO_WIN_MAP: dict[str, str]
result: _IntermediateResultType
done: bool
lang_filter: int
logger: Logger
def __init__(self, lang_filter: int = 31) -> None: ...
def reset(self) -> None: ...
def feed(self, byte_str: bytes | bytearray) -> None: ...
def close(self) -> _FinalResultType: ...

View File

@ -0,0 +1,2 @@
__version__: str
VERSION: list[str]

View File

@ -1,4 +1,4 @@
version = "23.6.5"
version = "23.5.9"
partial_stub = true
[tool.stubtest]

View File

@ -1,4 +1,4 @@
version = "3.2.*"
version = "3.0.*"
# Requires a version of cryptography where cryptography.hazmat.primitives.ciphers.Cipher is generic
requires = ["cryptography>=37.0.0"]
partial_stub = true

View File

@ -62,8 +62,7 @@ class AgentKey(PKey):
blob: bytes
public_blob: None
name: str
comment: str
def __init__(self, agent: AgentSSH, blob: ReadableBuffer, comment: str = "") -> None: ...
def __init__(self, agent: AgentSSH, blob: ReadableBuffer) -> None: ...
def asbytes(self) -> bytes: ...
def get_name(self) -> str: ...
def sign_ssh_data(self, data: _LikeBytes, algorithm: str | None = None) -> Message: ...

View File

@ -1,57 +0,0 @@
import abc
from collections.abc import Callable, Iterator
from logging import Logger
from pathlib import Path
from typing import NamedTuple
from paramiko.config import SSHConfig
from paramiko.pkey import PKey
from paramiko.ssh_exception import AuthenticationException
from paramiko.transport import Transport
class AuthSource:
username: str
def __init__(self, username: str) -> None: ...
@abc.abstractmethod
def authenticate(self, transport: Transport) -> list[str]: ...
class NoneAuth(AuthSource):
def authenticate(self, transport: Transport) -> list[str]: ...
class Password(AuthSource):
password_getter: Callable[[], str]
def __init__(self, username: str, password_getter: Callable[[], str]) -> None: ...
def authenticate(self, transport: Transport) -> list[str]: ...
class PrivateKey(AuthSource):
def authenticate(self, transport: Transport) -> list[str]: ...
class InMemoryPrivateKey(PrivateKey):
pkey: PKey
def __init__(self, username: str, pkey: PKey) -> None: ...
class OnDiskPrivateKey(PrivateKey):
source: str
path: Path
pkey: PKey
def __init__(self, username: str, source: str, path: Path, pkey: PKey) -> None: ...
class SourceResult(NamedTuple):
source: AuthSource
result: list[str] | Exception
class AuthResult(list[SourceResult]):
strategy: AuthStrategy
def __init__(self, strategy: AuthStrategy, *args: SourceResult, **kwargs: object) -> None: ...
class AuthFailure(AuthenticationException):
result: AuthResult
def __init__(self, result: AuthResult) -> None: ...
class AuthStrategy:
ssh_config: SSHConfig
log: Logger
def __init__(self, ssh_config: SSHConfig) -> None: ...
@abc.abstractmethod
def get_sources(self) -> Iterator[AuthSource]: ...
def authenticate(self, transport: Transport) -> list[SourceResult]: ...

View File

@ -1,14 +1,15 @@
from collections.abc import Iterable, Mapping
from typing import NoReturn, Protocol
from paramiko.auth_strategy import AuthStrategy
from paramiko.channel import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile
from paramiko.hostkeys import HostKeys
from paramiko.pkey import PKey
from paramiko.sftp_client import SFTPClient
from paramiko.transport import Transport, _SocketLike
from paramiko.transport import Transport
from paramiko.util import ClosingContextManager
from .transport import _SocketLike
class _TransportFactory(Protocol):
def __call__(
self,
@ -46,12 +47,10 @@ class SSHClient(ClosingContextManager):
gss_host: str | None = None,
banner_timeout: float | None = None,
auth_timeout: float | None = None,
channel_timeout: float | None = None,
gss_trust_dns: bool = True,
passphrase: str | None = None,
disabled_algorithms: Mapping[str, Iterable[str]] | None = None,
transport_factory: _TransportFactory | None = None,
auth_strategy: AuthStrategy | None = None,
) -> None: ...
def close(self) -> None: ...
def exec_command(

View File

@ -27,7 +27,7 @@ class RSAKey(PKey):
def get_name(self) -> str: ...
def get_bits(self) -> int: ...
def can_sign(self) -> bool: ...
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ... # type: ignore[override]
def sign_ssh_data(self, data: bytes, algorithm: str = "ssh-rsa") -> Message: ... # type: ignore[override]
def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ...
def write_private_key_file(self, filename: str, password: str | None = None) -> None: ...
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...

View File

@ -231,12 +231,7 @@ def wait_procs(
) -> tuple[list[Process], list[Process]]: ...
def cpu_count(logical: bool = True) -> int: ...
def cpu_times(percpu: bool = False): ...
@overload
def cpu_percent(interval: float | None = None, percpu: Literal[False] = False) -> float: ...
@overload
def cpu_percent(interval: float | None, percpu: Literal[True]) -> list[float]: ...
@overload
def cpu_percent(*, percpu: Literal[True]) -> list[float]: ...
def cpu_percent(interval: float | None = None, percpu: bool = False) -> float: ...
def cpu_times_percent(interval: float | None = None, percpu: bool = False): ...
def cpu_stats() -> scpustats: ...
def cpu_freq(percpu: bool = False) -> scpufreq: ...

View File

@ -1,4 +1,4 @@
version = "23.2.*"
version = "23.1.*"
# Requires a version of cryptography with a `py.typed` file
requires = ["cryptography>=35.0.0"]
partial_stub = true

View File

@ -1,6 +1,5 @@
version = "8.0.0.*"
partial_stub = true
obsolete_since = "8.0.1.0.1" # Released on 2023-05-25
[tool.stubtest]
ignore_missing_stub = true

View File

@ -2,8 +2,7 @@
# "KeyError: 'pywintypes'"
from _typeshed import Incomplete
from datetime import datetime
from typing import NoReturn
from typing_extensions import Literal, Never
from typing_extensions import Literal
import _win32typing
@ -16,15 +15,6 @@ class error(Exception):
class com_error(Exception): ...
class UnicodeType(str): ...
class HANDLEType:
def __init__(self, *args: Never, **kwargs: Never) -> NoReturn: ...
@property
def handle(self) -> int: ...
def Close(self) -> None: ...
def close(self) -> None: ...
def Detach(self) -> None: ...
def __int__(self) -> int: ...
class TimeType(datetime):
Format = datetime.strftime
@ -42,7 +32,7 @@ def ACL(__bufSize: int = ...) -> _win32typing.PyACL: ...
def SID(buffer, idAuthority, subAuthorities, bufSize=...) -> _win32typing.PySID: ...
def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ...
def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ...
def HANDLE() -> HANDLEType: ...
def HANDLE() -> int: ...
def HKEY() -> _win32typing.PyHKEY: ...
def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ...
def TimeStamp(*args, **kwargs): ... # incomplete

View File

@ -1 +1 @@
version = "2023.6.3"
version = "2023.5.5"

View File

@ -1,4 +1,4 @@
version = "2.31.*"
version = "2.30.*"
requires = ["types-urllib3"]
[tool.stubtest]