Updated typeshed stubs to the latest version.

This commit is contained in:
Eric Traut 2024-05-06 22:19:18 -07:00
parent 3ead033827
commit 0ead803de9
66 changed files with 695 additions and 419 deletions

View File

@ -1 +1 @@
7ed91bc2e77ec18d28307dc6086a778ecc9c7bb3
727f3c4320d2af3af2f16695e24dd78e79b7c070

View File

@ -151,13 +151,22 @@ class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]):
def keys(self) -> Iterable[_KT]: ...
def __getitem__(self, key: _KT, /) -> _VT_co: ...
# stable
# This protocol is currently under discussion. Use SupportsContainsAndGetItem
# instead, if you require the __contains__ method.
# See https://github.com/python/typeshed/issues/11822.
class SupportsGetItem(Protocol[_KT_contra, _VT_co]):
def __contains__(self, x: Any, /) -> bool: ...
def __getitem__(self, key: _KT_contra, /) -> _VT_co: ...
# stable
class SupportsItemAccess(SupportsGetItem[_KT_contra, _VT], Protocol[_KT_contra, _VT]):
class SupportsContainsAndGetItem(Protocol[_KT_contra, _VT_co]):
def __contains__(self, x: Any, /) -> bool: ...
def __getitem__(self, key: _KT_contra, /) -> _VT_co: ...
# stable
class SupportsItemAccess(Protocol[_KT_contra, _VT]):
def __contains__(self, x: Any, /) -> bool: ...
def __getitem__(self, key: _KT_contra, /) -> _VT: ...
def __setitem__(self, key: _KT_contra, value: _VT, /) -> None: ...
def __delitem__(self, key: _KT_contra, /) -> None: ...

View File

@ -1,7 +1,7 @@
import sys
from collections.abc import Awaitable, Callable, Coroutine
from typing import Any, TypeVar, overload
from typing_extensions import ParamSpec, TypeGuard
from typing_extensions import ParamSpec, TypeGuard, TypeIs
if sys.version_info >= (3, 11):
__all__ = ("iscoroutinefunction", "iscoroutine")
@ -23,4 +23,4 @@ def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable
def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ...
def iscoroutine(obj: object) -> TypeGuard[Coroutine[Any, Any, Any]]: ...
def iscoroutine(obj: object) -> TypeIs[Coroutine[Any, Any, Any]]: ...

View File

@ -3,7 +3,7 @@ from collections.abc import Awaitable, Callable, Generator, Iterable
from concurrent.futures._base import Future as _ConcurrentFuture
from contextvars import Context
from typing import Any, Literal, TypeVar
from typing_extensions import Self, TypeGuard
from typing_extensions import Self, TypeIs
from .events import AbstractEventLoop
@ -17,7 +17,7 @@ _T = TypeVar("_T")
# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py
# but it leads to circular import error in pytype tool.
# That's why the import order is reversed.
def isfuture(obj: object) -> TypeGuard[Future[Any]]: ...
def isfuture(obj: object) -> TypeIs[Future[Any]]: ...
class Future(Awaitable[_T], Iterable[_T]):
_state: str

View File

@ -1,32 +1,32 @@
from typing_extensions import TypeAlias
from typing_extensions import Buffer, TypeAlias
_AdpcmState: TypeAlias = tuple[int, int]
_RatecvState: TypeAlias = tuple[int, tuple[tuple[int, int], ...]]
class error(Exception): ...
def add(fragment1: bytes, fragment2: bytes, width: int, /) -> bytes: ...
def adpcm2lin(fragment: bytes, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]: ...
def alaw2lin(fragment: bytes, width: int, /) -> bytes: ...
def avg(fragment: bytes, width: int, /) -> int: ...
def avgpp(fragment: bytes, width: int, /) -> int: ...
def bias(fragment: bytes, width: int, bias: int, /) -> bytes: ...
def byteswap(fragment: bytes, width: int, /) -> bytes: ...
def cross(fragment: bytes, width: int, /) -> int: ...
def findfactor(fragment: bytes, reference: bytes, /) -> float: ...
def findfit(fragment: bytes, reference: bytes, /) -> tuple[int, float]: ...
def findmax(fragment: bytes, length: int, /) -> int: ...
def getsample(fragment: bytes, width: int, index: int, /) -> int: ...
def lin2adpcm(fragment: bytes, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]: ...
def lin2alaw(fragment: bytes, width: int, /) -> bytes: ...
def lin2lin(fragment: bytes, width: int, newwidth: int, /) -> bytes: ...
def lin2ulaw(fragment: bytes, width: int, /) -> bytes: ...
def max(fragment: bytes, width: int, /) -> int: ...
def maxpp(fragment: bytes, width: int, /) -> int: ...
def minmax(fragment: bytes, width: int, /) -> tuple[int, int]: ...
def mul(fragment: bytes, width: int, factor: float, /) -> bytes: ...
def add(fragment1: Buffer, fragment2: Buffer, width: int, /) -> bytes: ...
def adpcm2lin(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]: ...
def alaw2lin(fragment: Buffer, width: int, /) -> bytes: ...
def avg(fragment: Buffer, width: int, /) -> int: ...
def avgpp(fragment: Buffer, width: int, /) -> int: ...
def bias(fragment: Buffer, width: int, bias: int, /) -> bytes: ...
def byteswap(fragment: Buffer, width: int, /) -> bytes: ...
def cross(fragment: Buffer, width: int, /) -> int: ...
def findfactor(fragment: Buffer, reference: Buffer, /) -> float: ...
def findfit(fragment: Buffer, reference: Buffer, /) -> tuple[int, float]: ...
def findmax(fragment: Buffer, length: int, /) -> int: ...
def getsample(fragment: Buffer, width: int, index: int, /) -> int: ...
def lin2adpcm(fragment: Buffer, width: int, state: _AdpcmState | None, /) -> tuple[bytes, _AdpcmState]: ...
def lin2alaw(fragment: Buffer, width: int, /) -> bytes: ...
def lin2lin(fragment: Buffer, width: int, newwidth: int, /) -> bytes: ...
def lin2ulaw(fragment: Buffer, width: int, /) -> bytes: ...
def max(fragment: Buffer, width: int, /) -> int: ...
def maxpp(fragment: Buffer, width: int, /) -> int: ...
def minmax(fragment: Buffer, width: int, /) -> tuple[int, int]: ...
def mul(fragment: Buffer, width: int, factor: float, /) -> bytes: ...
def ratecv(
fragment: bytes,
fragment: Buffer,
width: int,
nchannels: int,
inrate: int,
@ -36,8 +36,8 @@ def ratecv(
weightB: int = 0,
/,
) -> tuple[bytes, _RatecvState]: ...
def reverse(fragment: bytes, width: int, /) -> bytes: ...
def rms(fragment: bytes, width: int, /) -> int: ...
def tomono(fragment: bytes, width: int, lfactor: float, rfactor: float, /) -> bytes: ...
def tostereo(fragment: bytes, width: int, lfactor: float, rfactor: float, /) -> bytes: ...
def ulaw2lin(fragment: bytes, width: int, /) -> bytes: ...
def reverse(fragment: Buffer, width: int, /) -> bytes: ...
def rms(fragment: Buffer, width: int, /) -> int: ...
def tomono(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes: ...
def tostereo(fragment: Buffer, width: int, lfactor: float, rfactor: float, /) -> bytes: ...
def ulaw2lin(fragment: Buffer, width: int, /) -> bytes: ...

View File

@ -66,6 +66,7 @@ from typing_extensions import ( # noqa: Y023
Self,
TypeAlias,
TypeGuard,
TypeIs,
TypeVarTuple,
deprecated,
)
@ -1031,15 +1032,25 @@ class dict(MutableMapping[_KT, _VT]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ...
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
@overload
def __init__(self: dict[str, _VT], map: SupportsKeysAndGetItem[str, _VT], /, **kwargs: _VT) -> None: ...
def __init__(
self: dict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
map: SupportsKeysAndGetItem[str, _VT],
/,
**kwargs: _VT,
) -> None: ...
@overload
def __init__(self, iterable: Iterable[tuple[_KT, _VT]], /) -> None: ...
@overload
def __init__(self: dict[str, _VT], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT) -> None: ...
def __init__(
self: dict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
iterable: Iterable[tuple[str, _VT]],
/,
**kwargs: _VT,
) -> None: ...
# Next two overloads are for dict(string.split(sep) for string in iterable)
# Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error
@overload
@ -1231,7 +1242,7 @@ def any(iterable: Iterable[object], /) -> bool: ...
def ascii(obj: object, /) -> str: ...
def bin(number: int | SupportsIndex, /) -> str: ...
def breakpoint(*args: Any, **kws: Any) -> None: ...
def callable(obj: object, /) -> TypeGuard[Callable[..., object]]: ...
def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ...
def chr(i: int, /) -> str: ...
# We define this here instead of using os.PathLike to avoid import cycle issues.
@ -1341,6 +1352,8 @@ class filter(Iterator[_T]):
@overload
def __new__(cls, function: Callable[[_S], TypeGuard[_T]], iterable: Iterable[_S], /) -> Self: ...
@overload
def __new__(cls, function: Callable[[_S], TypeIs[_T]], iterable: Iterable[_S], /) -> Self: ...
@overload
def __new__(cls, function: Callable[[_T], Any], iterable: Iterable[_T], /) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T: ...

View File

@ -1,4 +1,4 @@
from _typeshed import SupportsGetItem, SupportsItemAccess, Unused
from _typeshed import SupportsContainsAndGetItem, SupportsGetItem, SupportsItemAccess, Unused
from builtins import list as _list, type as _type
from collections.abc import Iterable, Iterator, Mapping
from email.message import Message
@ -85,7 +85,7 @@ class FieldStorage:
fp: IO[Any] | None = None,
headers: Mapping[str, str] | Message | None = None,
outerboundary: bytes = b"",
environ: SupportsGetItem[str, str] = ...,
environ: SupportsContainsAndGetItem[str, str] = ...,
keep_blank_values: int = 0,
strict_parsing: int = 0,
limit: int | None = None,

View File

@ -51,15 +51,27 @@ class UserDict(MutableMapping[_KT, _VT]):
@overload
def __init__(self, dict: None = None, /) -> None: ...
@overload
def __init__(self: UserDict[str, _VT], dict: None = None, /, **kwargs: _VT) -> None: ...
def __init__(
self: UserDict[str, _VT], dict: None = None, /, **kwargs: _VT # pyright: ignore[reportInvalidTypeVarUse] #11780
) -> None: ...
@overload
def __init__(self, dict: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
@overload
def __init__(self: UserDict[str, _VT], dict: SupportsKeysAndGetItem[str, _VT], /, **kwargs: _VT) -> None: ...
def __init__(
self: UserDict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
dict: SupportsKeysAndGetItem[str, _VT],
/,
**kwargs: _VT,
) -> None: ...
@overload
def __init__(self, iterable: Iterable[tuple[_KT, _VT]], /) -> None: ...
@overload
def __init__(self: UserDict[str, _VT], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT) -> None: ...
def __init__(
self: UserDict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
iterable: Iterable[tuple[str, _VT]],
/,
**kwargs: _VT,
) -> None: ...
@overload
def __init__(self: UserDict[str, str], iterable: Iterable[list[str]], /) -> None: ...
@overload
@ -389,16 +401,21 @@ class defaultdict(dict[_KT, _VT]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self: defaultdict[str, _VT], **kwargs: _VT) -> None: ...
def __init__(self: defaultdict[str, _VT], **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __init__(self, default_factory: Callable[[], _VT] | None, /) -> None: ...
@overload
def __init__(self: defaultdict[str, _VT], default_factory: Callable[[], _VT] | None, /, **kwargs: _VT) -> None: ...
def __init__(
self: defaultdict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
default_factory: Callable[[], _VT] | None,
/,
**kwargs: _VT,
) -> None: ...
@overload
def __init__(self, default_factory: Callable[[], _VT] | None, map: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
@overload
def __init__(
self: defaultdict[str, _VT],
self: defaultdict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
default_factory: Callable[[], _VT] | None,
map: SupportsKeysAndGetItem[str, _VT],
/,
@ -408,7 +425,7 @@ class defaultdict(dict[_KT, _VT]):
def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[tuple[_KT, _VT]], /) -> None: ...
@overload
def __init__(
self: defaultdict[str, _VT],
self: defaultdict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
default_factory: Callable[[], _VT] | None,
iterable: Iterable[tuple[str, _VT]],
/,

View File

@ -183,7 +183,7 @@ if sys.version_info >= (3, 10):
@overload
def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Unused) -> None: ...
async def __aenter__(self) -> _T: ...
@ -195,7 +195,7 @@ else:
@overload
def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Unused) -> None: ...

View File

@ -26,7 +26,7 @@ from types import (
WrapperDescriptorType,
)
from typing import Any, ClassVar, Literal, NamedTuple, Protocol, TypeVar, overload
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs
if sys.version_info >= (3, 11):
__all__ = [
@ -192,10 +192,10 @@ if sys.version_info >= (3, 11):
def getmembers_static(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn: ...
def getmodulename(path: StrPath) -> str | None: ...
def ismodule(object: object) -> TypeGuard[ModuleType]: ...
def isclass(object: object) -> TypeGuard[type[Any]]: ...
def ismethod(object: object) -> TypeGuard[MethodType]: ...
def isfunction(object: object) -> TypeGuard[FunctionType]: ...
def ismodule(object: object) -> TypeIs[ModuleType]: ...
def isclass(object: object) -> TypeIs[type[Any]]: ...
def ismethod(object: object) -> TypeIs[MethodType]: ...
def isfunction(object: object) -> TypeIs[FunctionType]: ...
if sys.version_info >= (3, 12):
def markcoroutinefunction(func: _F) -> _F: ...
@ -214,9 +214,9 @@ def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[
def iscoroutinefunction(obj: Callable[_P, object]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ...
@overload
def iscoroutinefunction(obj: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ...
def isgenerator(object: object) -> TypeGuard[GeneratorType[Any, Any, Any]]: ...
def iscoroutine(object: object) -> TypeGuard[CoroutineType[Any, Any, Any]]: ...
def isawaitable(object: object) -> TypeGuard[Awaitable[Any]]: ...
def isgenerator(object: object) -> TypeIs[GeneratorType[Any, Any, Any]]: ...
def iscoroutine(object: object) -> TypeIs[CoroutineType[Any, Any, Any]]: ...
def isawaitable(object: object) -> TypeIs[Awaitable[Any]]: ...
@overload
def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ...
@overload
@ -230,18 +230,18 @@ class _SupportsSet(Protocol[_T_cont, _V_cont]):
class _SupportsDelete(Protocol[_T_cont]):
def __delete__(self, instance: _T_cont, /) -> None: ...
def isasyncgen(object: object) -> TypeGuard[AsyncGeneratorType[Any, Any]]: ...
def istraceback(object: object) -> TypeGuard[TracebackType]: ...
def isframe(object: object) -> TypeGuard[FrameType]: ...
def iscode(object: object) -> TypeGuard[CodeType]: ...
def isbuiltin(object: object) -> TypeGuard[BuiltinFunctionType]: ...
def isasyncgen(object: object) -> TypeIs[AsyncGeneratorType[Any, Any]]: ...
def istraceback(object: object) -> TypeIs[TracebackType]: ...
def isframe(object: object) -> TypeIs[FrameType]: ...
def iscode(object: object) -> TypeIs[CodeType]: ...
def isbuiltin(object: object) -> TypeIs[BuiltinFunctionType]: ...
if sys.version_info >= (3, 11):
def ismethodwrapper(object: object) -> TypeGuard[MethodWrapperType]: ...
def ismethodwrapper(object: object) -> TypeIs[MethodWrapperType]: ...
def isroutine(
object: object,
) -> TypeGuard[
) -> TypeIs[
FunctionType
| LambdaType
| MethodType
@ -251,11 +251,11 @@ def isroutine(
| MethodDescriptorType
| ClassMethodDescriptorType
]: ...
def ismethoddescriptor(object: object) -> TypeGuard[MethodDescriptorType]: ...
def ismemberdescriptor(object: object) -> TypeGuard[MemberDescriptorType]: ...
def ismethoddescriptor(object: object) -> TypeIs[MethodDescriptorType]: ...
def ismemberdescriptor(object: object) -> TypeIs[MemberDescriptorType]: ...
def isabstract(object: object) -> bool: ...
def isgetsetdescriptor(object: object) -> TypeGuard[GetSetDescriptorType]: ...
def isdatadescriptor(object: object) -> TypeGuard[_SupportsSet[Any, Any] | _SupportsDelete[Any]]: ...
def isgetsetdescriptor(object: object) -> TypeIs[GetSetDescriptorType]: ...
def isdatadescriptor(object: object) -> TypeIs[_SupportsSet[Any, Any] | _SupportsDelete[Any]]: ...
#
# Retrieving source code

View File

@ -597,7 +597,7 @@ class StreamHandler(Handler, Generic[_StreamT]):
@overload
def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: ...
@overload
def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ...
def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
def setStream(self, stream: _StreamT) -> _StreamT | None: ...
if sys.version_info >= (3, 11):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@ -1,13 +1,13 @@
import ctypes
import sys
from collections.abc import Callable, Iterable, Sequence
from ctypes import _CData
from ctypes import _CData, _SimpleCData, c_char
from logging import Logger, _Level as _LoggingLevel
from multiprocessing import popen_fork, popen_forkserver, popen_spawn_posix, popen_spawn_win32, queues, synchronize
from multiprocessing.managers import SyncManager
from multiprocessing.pool import Pool as _Pool
from multiprocessing.process import BaseProcess
from multiprocessing.sharedctypes import Synchronized, SynchronizedArray
from multiprocessing.sharedctypes import Synchronized, SynchronizedArray, SynchronizedString
from typing import Any, ClassVar, Literal, TypeVar, overload
from typing_extensions import TypeAlias
@ -19,6 +19,7 @@ else:
__all__ = ()
_LockLike: TypeAlias = synchronize.Lock | synchronize.RLock
_T = TypeVar("_T")
_CT = TypeVar("_CT", bound=_CData)
class ProcessError(Exception): ...
@ -79,6 +80,10 @@ class BaseContext:
@overload
def RawArray(self, typecode_or_type: str, size_or_initializer: int | Sequence[Any]) -> Any: ...
@overload
def Value(
self, typecode_or_type: type[_SimpleCData[_T]], *args: Any, lock: Literal[True] | _LockLike = True
) -> Synchronized[_T]: ...
@overload
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> Synchronized[_CT]: ...
@overload
def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = True) -> Synchronized[_CT]: ...
@ -87,6 +92,10 @@ class BaseContext:
@overload
def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True) -> Any: ...
@overload
def Array(
self, typecode_or_type: type[c_char], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True
) -> SynchronizedString: ...
@overload
def Array(
self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]
) -> SynchronizedArray[_CT]: ...

View File

@ -443,7 +443,7 @@ class AsyncContextManager(AbstractAsyncContextManager[_T_co, bool | None], Proto
@runtime_checkable
class Awaitable(Protocol[_T_co]):
@abstractmethod
def __await__(self) -> Generator[Any, None, _T_co]: ...
def __await__(self) -> Generator[Any, Any, _T_co]: ...
class Coroutine(Awaitable[_ReturnT_co], Generic[_YieldT_co, _SendT_contra, _ReturnT_co]):
__name__: str

View File

@ -188,7 +188,7 @@ class _patch(Generic[_T]):
# but that's impossible with the current type system.
if sys.version_info >= (3, 10):
def __init__(
self: _patch[_T],
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
getter: Callable[[], Any],
attribute: str,
new: _T,
@ -203,7 +203,7 @@ class _patch(Generic[_T]):
) -> None: ...
else:
def __init__(
self: _patch[_T],
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
getter: Callable[[], Any],
attribute: str,
new: _T,

View File

@ -51,10 +51,17 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self: WeakValueDictionary[_KT, _VT], other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]], /) -> None: ...
def __init__(
self: WeakValueDictionary[_KT, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]],
/,
) -> None: ...
@overload
def __init__(
self: WeakValueDictionary[str, _VT], other: Mapping[str, _VT] | Iterable[tuple[str, _VT]] = (), /, **kwargs: _VT
self: WeakValueDictionary[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
other: Mapping[str, _VT] | Iterable[tuple[str, _VT]] = (),
/,
**kwargs: _VT,
) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, key: _KT) -> _VT: ...

View File

@ -5,8 +5,8 @@ requires = ["numpy>=1.20", "types-cffi"]
[tool.stubtest]
# darwin and win32 are equivalent
platforms = ["darwin", "linux"]
platforms = ["linux"]
apt_dependencies = ["libjack-dev"]
brew_dependencies = ["jack"]
# brew_dependencies = ["jack"]
# No need to install on the CI. Leaving here as information for Windows contributors.
# choco_dependencies = ["jack"]

View File

@ -124,7 +124,8 @@ class Connection(Generic[_C]):
) -> None: ...
@overload
def __init__(
self: Connection[_C], # different between overloads
# different between overloads:
self: Connection[_C], # pyright: ignore[reportInvalidTypeVarUse] #11780
*,
host: str | None = None,
user: Incomplete | None = None,

View File

@ -1,4 +1,4 @@
version = "2.17.*"
version = "2.18.*"
upstream_repository = "https://github.com/pygments/pygments"
requires = ["types-docutils", "types-setuptools"]
partial_stub = true

View File

@ -12,7 +12,7 @@ class FormField(Field, Generic[_BoundFormT]):
form: _BoundFormT
separator: str
def __init__(
self: FormField[_BoundFormT],
self: FormField[_BoundFormT], # pyright: ignore[reportInvalidTypeVarUse] #11780
form_class: type[_BoundFormT],
label: str | None = None,
validators: None = None,

View File

@ -15,7 +15,7 @@ class FieldList(Field, Generic[_BoundFieldT]):
entries: list[_BoundFieldT]
object_data: Iterable[Any]
def __init__(
self: FieldList[_BoundFieldT],
self: FieldList[_BoundFieldT], # pyright: ignore[reportInvalidTypeVarUse] #11780
# because of our workaround we need to accept Field as well
unbound_field: UnboundField[_BoundFieldT] | _BoundFieldT,
label: str | None = None,

View File

@ -45,7 +45,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, []],
self: wsgify[_RequestT_contra, []], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _RequestHandler[_RequestT_contra, []] | None,
RequestClass: type[_RequestT_contra],
args: tuple[()] = (),
@ -54,7 +54,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, []],
self: wsgify[_RequestT_contra, []], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _RequestHandler[_RequestT_contra, []] | None = None,
*,
RequestClass: type[_RequestT_contra],
@ -74,7 +74,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, [_AppT_contra]],
self: wsgify[_RequestT_contra, [_AppT_contra]], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _Middleware[_RequestT_contra, _AppT_contra, []] | None,
RequestClass: type[_RequestT_contra],
args: tuple[()] = (),
@ -84,7 +84,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, [_AppT_contra]],
self: wsgify[_RequestT_contra, [_AppT_contra]], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _Middleware[_RequestT_contra, _AppT_contra, []] | None = None,
*,
RequestClass: type[_RequestT_contra],

View File

@ -34,6 +34,8 @@ class HTMLFormatter(Formatter):
entity_substitution: _EntitySubstitution | None = ...,
void_element_close_prefix: str = ...,
cdata_containing_tags: list[str] | None = ...,
empty_attributes_are_booleans: bool = False,
indent: int = 1,
) -> None: ...
class XMLFormatter(Formatter):
@ -43,4 +45,6 @@ class XMLFormatter(Formatter):
entity_substitution: _EntitySubstitution | None = ...,
void_element_close_prefix: str = ...,
cdata_containing_tags: list[str] | None = ...,
empty_attributes_are_booleans: bool = False,
indent: int = 1,
) -> None: ...

View File

@ -1,23 +1,26 @@
from _typeshed import Incomplete
from datetime import datetime
from typing import Any
from docker.types.daemon import CancellableStream
class DaemonApiMixin:
def df(self): ...
def df(self) -> dict[str, Any]: ...
def events(
self,
since: Incomplete | None = None,
until: Incomplete | None = None,
filters: Incomplete | None = None,
decode: Incomplete | None = None,
): ...
def info(self): ...
since: datetime | int | None = None,
until: datetime | int | None = None,
filters: dict[str, Any] | None = None,
decode: bool | None = None,
) -> CancellableStream: ...
def info(self) -> dict[str, Any]: ...
def login(
self,
username,
password: Incomplete | None = None,
email: Incomplete | None = None,
registry: Incomplete | None = None,
username: str,
password: str | None = None,
email: str | None = None,
registry: str | None = None,
reauth: bool = False,
dockercfg_path: Incomplete | None = None,
): ...
def ping(self): ...
def version(self, api_version: bool = True): ...
dockercfg_path: str | None = None,
) -> dict[str, Any]: ...
def ping(self) -> bool: ...
def version(self, api_version: bool = True) -> dict[str, Any]: ...

View File

@ -1,7 +1,12 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any
from docker.types import DriverConfig
class SecretApiMixin:
def create_secret(self, name, data, labels: Incomplete | None = None, driver: Incomplete | None = None): ...
def inspect_secret(self, id): ...
def remove_secret(self, id): ...
def secrets(self, filters: Incomplete | None = None): ...
def create_secret(
self, name: str, data: bytes, labels: dict[str, Any] | None = None, driver: DriverConfig | None = None
) -> dict[str, Any]: ...
def inspect_secret(self, id: str) -> dict[str, Any]: ...
def remove_secret(self, id: str) -> bool: ...
def secrets(self, filters: dict[str, Any] | None = None) -> Iterable[dict[str, Any]]: ...

View File

@ -1,14 +1,14 @@
from _typeshed import Incomplete
from typing import Any
class VolumeApiMixin:
def volumes(self, filters: Incomplete | None = None): ...
def volumes(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ...
def create_volume(
self,
name: Incomplete | None = None,
driver: Incomplete | None = None,
driver_opts: Incomplete | None = None,
labels: Incomplete | None = None,
): ...
def inspect_volume(self, name): ...
def prune_volumes(self, filters: Incomplete | None = None): ...
name: str | None = None,
driver: str | None = None,
driver_opts: dict[str, Any] | None = None,
labels: dict[str, Any] | None = None,
) -> dict[str, Any]: ...
def inspect_volume(self, name: str) -> dict[str, Any]: ...
def prune_volumes(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ...
def remove_volume(self, name, force: bool = False) -> None: ...

View File

@ -1,5 +1,4 @@
from _typeshed import Incomplete
from collections.abc import Mapping, Sequence
from collections.abc import Sequence
from docker.context.context import Context
from docker.tls import TLSConfig
@ -27,4 +26,4 @@ class ContextAPI:
@classmethod
def remove_context(cls, name: str) -> None: ...
@classmethod
def inspect_context(cls, name: str = "default") -> Mapping[str, Incomplete]: ...
def inspect_context(cls, name: str = "default") -> Context: ...

View File

@ -1,47 +1,76 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from typing import Any, TypedDict, type_check_only
@type_check_only
class _StorageData(TypedDict):
MetadataPath: str
TLSPath: str
@type_check_only
class _Storage(TypedDict):
Storage: _StorageData
@type_check_only
class _Endpoint(TypedDict, total=False):
Host: str
SkipTLSVerify: bool
@type_check_only
class _TLSMaterial:
TLSMaterial: dict[str, list[str]]
@type_check_only
class _MetaMetaData(TypedDict, total=False):
StackOrchestrator: str
@type_check_only
class _Metadata(TypedDict):
Name: str
Metadata: _MetaMetaData
Endpoints: Mapping[str, _Endpoint]
class Context:
name: Incomplete
context_type: Incomplete
orchestrator: Incomplete
endpoints: Incomplete
tls_cfg: Incomplete
name: str
context_type: str | None
orchestrator: str | None
endpoints: dict[str, _Endpoint]
tls_cfg: dict[str, Any]
meta_path: str
tls_path: str
def __init__(
self,
name,
orchestrator: Incomplete | None = None,
host: Incomplete | None = None,
endpoints: Incomplete | None = None,
name: str,
orchestrator: str | None = None,
host: str | None = None,
endpoints: Mapping[str, _Endpoint] | None = None,
tls: bool = False,
) -> None: ...
def set_endpoint(
self,
name: str = "docker",
host: Incomplete | None = None,
tls_cfg: Incomplete | None = None,
host: str | None = None,
tls_cfg: Mapping[str, Any] | None = None,
skip_tls_verify: bool = False,
def_namespace: Incomplete | None = None,
def_namespace: str | None = None,
) -> None: ...
def inspect(self): ...
def inspect(self) -> Mapping[str, Any]: ...
@classmethod
def load_context(cls, name): ...
def load_context(cls, name: str) -> Context | None: ...
def save(self) -> None: ...
def remove(self) -> None: ...
def __call__(self): ...
def is_docker_host(self): ...
def __call__(self) -> Mapping[str, Any]: ...
def is_docker_host(self) -> bool: ...
@property
def Name(self): ...
def Name(self) -> str: ...
@property
def Host(self): ...
def Host(self) -> str | None: ...
@property
def Orchestrator(self): ...
def Orchestrator(self) -> str: ...
@property
def Metadata(self): ...
def Metadata(self) -> _Metadata: ...
@property
def TLSConfig(self): ...
def TLSConfig(self) -> Any: ...
@property
def TLSMaterial(self): ...
def TLSMaterial(self) -> _TLSMaterial: ...
@property
def Storage(self): ...
def Storage(self) -> _Storage: ...

View File

@ -3,11 +3,11 @@ from .resource import Collection, Model
class Config(Model):
id_attribute: str
@property
def name(self): ...
def remove(self): ...
def name(self) -> str: ...
def remove(self) -> bool: ...
class ConfigCollection(Collection):
class ConfigCollection(Collection[Config]):
model: type[Config]
def create(self, **kwargs): ...
def get(self, config_id): ...
def list(self, **kwargs): ...
def create(self, **kwargs) -> Config: ... # type:ignore[override]
def get(self, config_id: str) -> Config: ...
def list(self, **kwargs) -> list[Config]: ...

View File

@ -42,19 +42,19 @@ class Container(Model):
def logs(self, **kwargs): ...
def pause(self): ...
def put_archive(self, path, data): ...
def remove(self, **kwargs): ...
def remove(self, **kwargs) -> None: ...
def rename(self, name): ...
def resize(self, height, width): ...
def restart(self, **kwargs): ...
def start(self, **kwargs): ...
def stats(self, **kwargs): ...
def stop(self, **kwargs): ...
def stop(self, **kwargs) -> None: ...
def top(self, **kwargs): ...
def unpause(self): ...
def update(self, **kwargs): ...
def wait(self, **kwargs): ...
class ContainerCollection(Collection):
class ContainerCollection(Collection[Container]):
model: type[Container]
def run(
self, image, command: Incomplete | None = None, stdout: bool = True, stderr: bool = False, remove: bool = False, **kwargs

View File

@ -1,43 +1,51 @@
from _typeshed import Incomplete
from collections.abc import Iterator
from typing import Any, Literal, overload
from typing_extensions import TypeAlias
from .resource import Collection, Model
_ImageList: TypeAlias = list[Image] # To resolve conflicts with a method called "list"
class Image(Model):
@property
def labels(self): ...
def labels(self) -> dict[str, Any]: ...
@property
def short_id(self): ...
def short_id(self) -> str: ...
@property
def tags(self): ...
def history(self): ...
def remove(self, force: bool = False, noprune: bool = False): ...
def save(self, chunk_size=2097152, named: bool = False): ...
def tag(self, repository, tag: str | None = None, **kwargs): ...
def tags(self) -> list[str]: ...
def history(self) -> list[Any]: ...
def remove(self, force: bool = False, noprune: bool = False) -> dict[str, Any]: ...
def save(self, chunk_size: int = 2097152, named: bool = False) -> Iterator[Any]: ...
def tag(self, repository: str, tag: str | None = None, **kwargs) -> bool: ...
class RegistryData(Model):
image_name: Incomplete
def __init__(self, image_name, *args, **kwargs) -> None: ...
image_name: str
def __init__(self, image_name: str, *args, **kwargs) -> None: ...
@property
def id(self): ...
def id(self) -> str: ...
@property
def short_id(self): ...
def pull(self, platform: Incomplete | None = None): ...
def short_id(self) -> str: ...
def pull(self, platform: str | None = None) -> Image: ...
def has_platform(self, platform): ...
attrs: Incomplete
def reload(self) -> None: ...
class ImageCollection(Collection):
class ImageCollection(Collection[Image]):
model: type[Image]
def build(self, **kwargs): ...
def get(self, name): ...
def get_registry_data(self, name, auth_config: Incomplete | None = None): ...
def list(self, name: Incomplete | None = None, all: bool = False, filters: Incomplete | None = None): ...
def load(self, data): ...
def pull(self, repository, tag: str | None = None, all_tags: bool = False, **kwargs): ...
def push(self, repository, tag: str | None = None, **kwargs): ...
def build(self, **kwargs) -> tuple[Image, Iterator[Any]]: ...
def get(self, name: str) -> Image: ...
def get_registry_data(self, name, auth_config: dict[str, Any] | None = None) -> RegistryData: ...
def list(self, name: str | None = None, all: bool = False, filters: dict[str, Any] | None = None) -> _ImageList: ...
def load(self, data: bytes) -> _ImageList: ...
@overload
def pull(self, repository: str, tag: str | None = None, all_tags: Literal[False] = False, **kwargs) -> Image: ...
@overload
def pull(self, repository: str, tag: str | None = None, *, all_tags: Literal[True], **kwargs) -> _ImageList: ...
@overload
def pull(self, repository: str, tag: str | None, all_tags: Literal[True], **kwargs) -> _ImageList: ...
def push(self, repository: str, tag: str | None = None, **kwargs): ...
def remove(self, *args, **kwargs) -> None: ...
def search(self, *args, **kwargs): ...
def prune(self, filters: Incomplete | None = None): ...
def prune(self, filters: dict[str, Any] | None = None): ...
def prune_builds(self, *args, **kwargs): ...
def normalize_platform(platform, engine_info): ...

View File

@ -1,19 +1,20 @@
from _typeshed import Incomplete
from typing import Any
from .containers import Container
from .resource import Collection, Model
class Network(Model):
@property
def name(self): ...
def name(self) -> str | None: ...
@property
def containers(self): ...
def connect(self, container, *args, **kwargs): ...
def disconnect(self, container, *args, **kwargs): ...
def remove(self): ...
def containers(self) -> list[Container]: ...
def connect(self, container: str | Container, *args, **kwargs) -> None: ...
def disconnect(self, container: str | Container, *args, **kwargs) -> None: ...
def remove(self) -> None: ...
class NetworkCollection(Collection):
class NetworkCollection(Collection[Network]):
model: type[Network]
def create(self, name, *args, **kwargs): ...
def get(self, network_id, *args, **kwargs): ...
def list(self, *args, **kwargs): ...
def prune(self, filters: Incomplete | None = None): ...
def create(self, name: str, *args, **kwargs) -> Network: ... # type:ignore[override]
def get(self, network_id: str, *args, **kwargs) -> Network: ... # type:ignore[override]
def list(self, *args, **kwargs) -> list[Network]: ...
def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ...

View File

@ -7,7 +7,7 @@ class Node(Model):
def update(self, node_spec): ...
def remove(self, force: bool = False): ...
class NodeCollection(Collection):
class NodeCollection(Collection[Node]):
model: type[Node]
def get(self, node_id): ...
def list(self, *args, **kwargs): ...

View File

@ -17,7 +17,7 @@ class Plugin(Model):
def remove(self, force: bool = False): ...
def upgrade(self, remote: Incomplete | None = None) -> Generator[Incomplete, Incomplete, None]: ...
class PluginCollection(Collection):
class PluginCollection(Collection[Plugin]):
model: type[Plugin]
def create(self, name, plugin_data_dir, gzip: bool = False): ... # type:ignore[override]
def get(self, name): ...

View File

@ -1,27 +1,32 @@
from _typeshed import Incomplete
from typing import Any, Generic, NoReturn, TypeVar
from typing_extensions import Self
from docker import APIClient
_T = TypeVar("_T", bound=Model)
class Model:
id_attribute: str
client: Incomplete
collection: Incomplete
attrs: Incomplete
client: APIClient | None
collection: Collection[Self] | None
attrs: dict[str, Any]
def __init__(
self, attrs: Incomplete | None = None, client: Incomplete | None = None, collection: Incomplete | None = None
self, attrs: dict[str, Any] | None = None, client: APIClient | None = None, collection: Collection[Self] | None = None
) -> None: ...
def __eq__(self, other): ...
def __hash__(self): ...
def __eq__(self, other) -> bool: ...
def __hash__(self) -> int: ...
@property
def id(self): ...
def id(self) -> str | None: ...
@property
def short_id(self): ...
def short_id(self) -> str: ...
def reload(self) -> None: ...
class Collection:
model: Incomplete
client: Incomplete
def __init__(self, client: Incomplete | None = None) -> None: ...
def __call__(self, *args, **kwargs) -> None: ...
def list(self) -> None: ...
def get(self, key) -> None: ...
def create(self, attrs: Incomplete | None = None) -> None: ...
def prepare_model(self, attrs): ...
class Collection(Generic[_T]):
model: type[_T]
client: APIClient
def __init__(self, client: APIClient | None = None) -> None: ...
def __call__(self, *args, **kwargs) -> NoReturn: ...
def list(self) -> list[_T]: ...
def get(self, key: str) -> _T: ...
def create(self, attrs: Any | None = None) -> _T: ...
def prepare_model(self, attrs: Model | dict[str, Any]) -> _T: ...

View File

@ -6,7 +6,7 @@ class Secret(Model):
def name(self): ...
def remove(self): ...
class SecretCollection(Collection):
class SecretCollection(Collection[Secret]):
model: type[Secret]
def create(self, **kwargs): ...
def get(self, secret_id): ...

View File

@ -15,7 +15,7 @@ class Service(Model):
def scale(self, replicas): ...
def force_update(self): ...
class ServiceCollection(Collection):
class ServiceCollection(Collection[Service]):
model: type[Service]
def create(self, image, command: Incomplete | None = None, **kwargs): ... # type:ignore[override]
def get(self, service_id, insert_defaults: Incomplete | None = None): ...

View File

@ -1,4 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any
from .resource import Model
@ -6,28 +7,27 @@ class Swarm(Model):
id_attribute: str
def __init__(self, *args, **kwargs) -> None: ...
@property
def version(self): ...
def get_unlock_key(self): ...
def version(self) -> str | None: ...
def get_unlock_key(self) -> dict[str, Any]: ...
def init(
self,
advertise_addr: Incomplete | None = None,
advertise_addr: str | None = None,
listen_addr: str = "0.0.0.0:2377",
force_new_cluster: bool = False,
default_addr_pool: Incomplete | None = None,
subnet_size: Incomplete | None = None,
data_path_addr: Incomplete | None = None,
data_path_port: Incomplete | None = None,
default_addr_pool: Iterable[str] | None = None,
subnet_size: int | None = None,
data_path_addr: str | None = None,
data_path_port: int | None = None,
**kwargs,
): ...
def join(self, *args, **kwargs): ...
def leave(self, *args, **kwargs): ...
attrs: Incomplete
) -> str: ...
def join(self, *args, **kwargs) -> bool: ...
def leave(self, *args, **kwargs) -> bool: ...
def reload(self) -> None: ...
def unlock(self, key): ...
def unlock(self, key: str) -> bool: ...
def update(
self,
rotate_worker_token: bool = False,
rotate_manager_token: bool = False,
rotate_manager_unlock_key: bool = False,
**kwargs,
): ...
) -> bool: ...

View File

@ -1,16 +1,16 @@
from _typeshed import Incomplete
from typing import Any
from .resource import Collection, Model
class Volume(Model):
id_attribute: str
@property
def name(self): ...
def remove(self, force: bool = False): ...
def name(self) -> str: ...
def remove(self, force: bool = False) -> None: ...
class VolumeCollection(Collection):
class VolumeCollection(Collection[Volume]):
model: type[Volume]
def create(self, name: Incomplete | None = None, **kwargs): ... # type:ignore[override]
def get(self, volume_id): ...
def list(self, **kwargs): ...
def prune(self, filters: Incomplete | None = None): ...
def create(self, name: str | None = None, **kwargs) -> Volume: ... # type:ignore[override]
def get(self, volume_id: str) -> Volume: ...
def list(self, **kwargs) -> list[Volume]: ...
def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ...

View File

@ -1,4 +1,4 @@
version = "24.4.21"
version = "24.4.26"
upstream_repository = "https://github.com/PyCQA/flake8-bugbear"
partial_stub = true

View File

@ -80,7 +80,9 @@ class OpenDescriptor(Generic[_IOT]):
def buffer_size_for_stream(cls, stream: object) -> int: ...
class FileObjectBase(Generic[_IOT, AnyStr]):
def __init__(self: FileObjectBase[_IOT, AnyStr], descriptor: OpenDescriptor[_IOT]) -> None: ...
def __init__(
self: FileObjectBase[_IOT, AnyStr], descriptor: OpenDescriptor[_IOT] # pyright: ignore[reportInvalidTypeVarUse] #11780
) -> None: ...
io: _IOT
@property
def closed(self) -> bool: ...

View File

@ -31,7 +31,9 @@ class Lazy(Generic[_T]):
class readproperty(Generic[_T]):
func: Callable[[Any], _T]
def __init__(self: readproperty[_T], func: Callable[[Any], _T]) -> None: ...
def __init__(
self: readproperty[_T], func: Callable[[Any], _T] # pyright: ignore[reportInvalidTypeVarUse] #11780
) -> None: ...
@overload
def __get__(self, inst: None, class_: type[object]) -> Self: ...
@overload

View File

@ -19,7 +19,12 @@ class Greenlet(greenlet.greenlet, Generic[_P, _T]):
kwargs: dict[str, Any]
value: _T | None
@overload
def __init__(self: Greenlet[_P, _T], run: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
def __init__(
self: Greenlet[_P, _T], # pyright: ignore[reportInvalidTypeVarUse] #11780
run: Callable[_P, _T],
*args: _P.args,
**kwargs: _P.kwargs,
) -> None: ...
@overload
def __init__(self: Greenlet[[], None]) -> None: ...
@readproperty

View File

@ -18,7 +18,7 @@ class Point:
def measurement(measurement: str) -> Point: ...
@staticmethod
def from_dict(
dictionary: SupportsGetItem[str, Any],
dictionary: SupportsGetItem[str, Any], # TODO: Use SupportsContainsAndGetItem
write_precision: _WritePrecision = "ns",
*,
record_measurement_name: str | None = ...,

View File

@ -1,4 +1,4 @@
version = "4.21.*"
version = "4.22.*"
upstream_repository = "https://github.com/python-jsonschema/jsonschema"
requires = ["referencing"]
partial_stub = true

View File

@ -160,15 +160,25 @@ class SassMap(Mapping[_KT, _VT_co]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ...
def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT_co], /) -> None: ...
@overload
def __init__(self: SassMap[str, _VT_co], map: SupportsKeysAndGetItem[str, _VT_co], /, **kwargs: _VT_co) -> None: ...
def __init__(
self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780
map: SupportsKeysAndGetItem[str, _VT_co],
/,
**kwargs: _VT_co,
) -> None: ...
@overload
def __init__(self, iterable: Iterable[tuple[_KT, _VT_co]], /) -> None: ...
@overload
def __init__(self: SassMap[str, _VT_co], iterable: Iterable[tuple[str, _VT_co]], /, **kwargs: _VT_co) -> None: ...
def __init__(
self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780
iterable: Iterable[tuple[str, _VT_co]],
/,
**kwargs: _VT_co,
) -> None: ...
def __getitem__(self, key: _KT) -> _VT_co: ...
def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ...

View File

@ -177,7 +177,7 @@ class _patch(Generic[_T]):
kwargs: Mapping[str, Any]
additional_patchers: Any
def __init__(
self: _patch[_T],
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
getter: Callable[[], Any],
attribute: str,
new: _T,

View File

@ -1,4 +1,4 @@
from _typeshed import SupportsGetItem
from _typeshed import SupportsKeysAndGetItem
from networkx.classes.graph import Graph, _Edge, _Node
from networkx.utils.backends import _dispatch
@ -11,7 +11,7 @@ def closeness_centrality(
def incremental_closeness_centrality(
G: Graph[_Node],
edge: _Edge[_Node],
prev_cc: SupportsGetItem[_Node, float] | None = None,
prev_cc: SupportsKeysAndGetItem[_Node, float] | None = None,
insertion: bool = True,
wf_improved: bool = True,
) -> dict[_Node, float]: ...

View File

@ -36,7 +36,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
@overload
def __init__(
self: Typed[_T, Literal[True]],
self: Typed[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -45,7 +45,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
) -> None: ...
@overload
def __init__(
self: Typed[_T, Literal[False]],
self: Typed[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -64,7 +64,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
class Convertible(Typed[_T, _N]):
@overload
def __init__(
self: Convertible[_T, Literal[True]],
self: Convertible[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -72,7 +72,7 @@ class Convertible(Typed[_T, _N]):
) -> None: ...
@overload
def __init__(
self: Convertible[_T, Literal[False]],
self: Convertible[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],

View File

@ -25,7 +25,7 @@ class Nested(Descriptor[_T]):
namespace: str | None
# In usage, "Nested" is closed to "Typed" than "Descriptor", but doesn't use allow_none
def __init__(
self: Nested[_T],
self: Nested[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -44,7 +44,7 @@ class Nested(Descriptor[_T]):
class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
@overload
def __init__(
self: NestedValue[_T, Literal[True]],
self: NestedValue[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -52,7 +52,7 @@ class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
) -> None: ...
@overload
def __init__(
self: NestedValue[_T, Literal[False]],
self: NestedValue[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -115,7 +115,7 @@ class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
class NestedText(NestedValue[_T, _N]):
@overload
def __init__(
self: NestedText[_T, Literal[True]],
self: NestedText[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@ -123,7 +123,7 @@ class NestedText(NestedValue[_T, _N]):
) -> None: ...
@overload
def __init__(
self: NestedText[_T, Literal[False]],
self: NestedText[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],

View File

@ -1,7 +1,7 @@
from _typeshed import Incomplete, Unused
from collections.abc import Iterator
from datetime import datetime
from typing import Any, Final
from typing import Any, Final, type_check_only
from typing_extensions import TypeAlias, deprecated
from zipfile import ZipFile
@ -17,6 +17,23 @@ from openpyxl.worksheet.worksheet import Worksheet
_WorkbookWorksheet: TypeAlias = Worksheet | WriteOnlyWorksheet | ReadOnlyWorksheet
_WorkbookSheet: TypeAlias = _WorkbookWorksheet | Chartsheet
# The type of worksheets in a workbook are the same as the aliases above.
# However, because Worksheet adds a lots of attributes that other _WorkbookChild subclasses
# don't have (ReadOnlyWorksheet doesn't even inherit from it), this ends up being too
# disruptive to the typical usage of openpyxl where sheets are just Worksheets.
# Using Any may just lose too much type information and duck-typing
# from Worksheet works great here. Allowing instance type check, even if direct
# type comparison might be wrong.
@type_check_only
class _WorksheetLike( # type: ignore[misc] # Incompatible definitions, favor Worksheet
Worksheet, WriteOnlyWorksheet, ReadOnlyWorksheet
): ...
@type_check_only
class _WorksheetOrChartsheetLike( # type: ignore[misc] # Incompatible definitions, favor Worksheet
Chartsheet, _WorksheetLike
): ...
INTEGER_TYPES: Final[tuple[type[int]]]
class Workbook:
@ -37,7 +54,7 @@ class Workbook:
views: Incomplete
# Useful as a reference of what "sheets" can be for other types
# ExcelReader can add ReadOnlyWorksheet in read_only mode.
# _sheets: list[_WorkbookSheet]
# _sheets: list[_WorksheetOrChartsheetLike]
def __init__(self, write_only: bool = False, iso_dates: bool = False) -> None: ...
@property
def epoch(self) -> datetime: ...
@ -52,7 +69,7 @@ class Workbook:
@property
def excel_base_date(self) -> datetime: ...
@property
def active(self) -> _WorkbookSheet | None: ...
def active(self) -> _WorksheetOrChartsheetLike | None: ...
@active.setter
def active(self, value: Worksheet | Chartsheet | int) -> None: ...
# read_only workbook cannot call this method
@ -66,18 +83,18 @@ class Workbook:
def remove_sheet(self, worksheet: _WorkbookSheet) -> None: ...
def create_chartsheet(self, title: str | _Decodable | None = None, index: int | None = None) -> Chartsheet: ...
@deprecated("Use wb[sheetname]")
def get_sheet_by_name(self, name: str) -> _WorkbookSheet: ...
def get_sheet_by_name(self, name: str) -> _WorksheetOrChartsheetLike: ...
def __contains__(self, key: str) -> bool: ...
def index(self, worksheet: _WorkbookWorksheet) -> int: ...
@deprecated("Use wb.index(worksheet)")
def get_index(self, worksheet: _WorkbookWorksheet) -> int: ...
def __getitem__(self, key: str) -> _WorkbookSheet: ...
def __getitem__(self, key: str) -> _WorksheetOrChartsheetLike: ...
def __delitem__(self, key: str) -> None: ...
def __iter__(self) -> Iterator[_WorkbookWorksheet]: ...
def __iter__(self) -> Iterator[_WorksheetLike]: ...
@deprecated("Use wb.sheetnames")
def get_sheet_names(self) -> list[str]: ...
@property
def worksheets(self) -> list[_WorkbookWorksheet]: ...
def worksheets(self) -> list[_WorksheetLike]: ...
@property
def chartsheets(self) -> list[Chartsheet]: ...
@property

View File

@ -1,4 +1,4 @@
version = "24.0.*"
version = "24.1.*"
upstream_repository = "https://github.com/pyca/pyopenssl"
# Requires a version of cryptography with a `py.typed` file
requires = ["cryptography>=35.0.0", "types-cffi"]

View File

@ -2,7 +2,7 @@ from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Callable, Iterable, Sequence
from datetime import datetime
from typing import Any
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey
@ -98,7 +98,7 @@ class X509Req:
def to_cryptography(self) -> CertificateSigningRequest: ...
def verify(self, pkey: PKey) -> bool: ...
# deprecated
@deprecated("X509Extension support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
class X509Extension:
def __init__(
self, type_name: bytes, critical: bool, value: bytes, subject: X509 | None = None, issuer: X509 | None = None
@ -107,7 +107,7 @@ class X509Extension:
def get_data(self) -> bytes: ...
def get_short_name(self) -> bytes: ...
# deprecated
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
class Revoked:
def __init__(self) -> None: ...
def all_reasons(self) -> list[bytes]: ...
@ -118,7 +118,7 @@ class Revoked:
def set_rev_date(self, when: bytes) -> None: ...
def set_serial(self, hex_str: bytes) -> None: ...
# deprecated
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
class CRL:
def __init__(self) -> None: ...
def add_revoked(self, revoked: Revoked) -> None: ...
@ -166,28 +166,6 @@ class X509StoreFlags:
CB_ISSUER_CHECK: int
PARTIAL_CHAIN: int
# deprecated
class PKCS12:
def __init__(self) -> None: ...
def export(self, passphrase: bytes | None = None, iter: int = 2048, maciter: int = 1) -> bytes: ...
def get_ca_certificates(self) -> tuple[X509, ...]: ...
def get_certificate(self) -> X509: ...
def get_friendlyname(self) -> bytes | None: ...
def get_privatekey(self) -> PKey: ...
def set_ca_certificates(self, cacerts: Iterable[X509] | None) -> None: ...
def set_certificate(self, cert: X509) -> None: ...
def set_friendlyname(self, name: bytes | None) -> None: ...
def set_privatekey(self, pkey: PKey) -> None: ...
# deprecated
class NetscapeSPKI:
def __init__(self) -> None: ...
def b64_encode(self) -> bytes: ...
def get_pubkey(self) -> PKey: ...
def set_pubkey(self, pkey: PKey) -> None: ...
def sign(self, pkey: PKey, digest: str) -> None: ...
def verify(self, key: PKey) -> bool: ...
def get_elliptic_curves() -> set[_EllipticCurve]: ...
def get_elliptic_curve(name: str) -> _EllipticCurve: ...
def dump_certificate(type: int, cert: X509) -> bytes: ...
@ -200,7 +178,11 @@ def dump_privatekey(
def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = None) -> PKey: ...
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
def load_publickey(type: int, buffer: str | bytes) -> PKey: ...
def dump_crl(type: int, crl: CRL) -> bytes: ... # deprecated
def load_crl(type: int, buffer: str | bytes) -> CRL: ... # deprecated
@deprecated("sign() is deprecated. Use the equivalent APIs in cryptography.")
def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes: ... # deprecated
@deprecated("verify() is deprecated. Use the equivalent APIs in cryptography.")
def verify(cert: X509, signature: bytes, data: str | bytes, digest: str) -> None: ... # deprecated
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
def dump_crl(type: int, crl: CRL) -> bytes: ...
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
def load_crl(type: int, buffer: str | bytes) -> CRL: ...

View File

@ -4,6 +4,6 @@ version = "0.2.*"
[tool.stubtest]
# linux and win32 are equivalent
platforms = ["darwin", "linux"]
platforms = ["linux"]
apt_dependencies = ["portaudio19-dev"]
brew_dependencies = ["portaudio"]
# brew_dependencies = ["portaudio"]

View File

@ -30,7 +30,7 @@ class Splash(Target):
binaries: list[_TOCTuple],
datas: list[_TOCTuple],
*,
text_pos: tuple[int, int] = ...,
text_pos: tuple[int, int] | None = ...,
text_size: int = 12,
text_font: str = ...,
text_color: str = "black",

View File

@ -308,7 +308,7 @@ class ConnectionPool(Generic[_ConnectionT]):
@overload
def __init__(
self: ConnectionPool[_ConnectionT],
self: ConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780
connection_class: type[_ConnectionT],
max_connections: int | None = None,
# **kwargs are passed to the constructed connection instances.
@ -332,7 +332,7 @@ class BlockingConnectionPool(ConnectionPool[_ConnectionT]):
@overload
def __init__(
self: BlockingConnectionPool[_ConnectionT],
self: BlockingConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780
max_connections: int,
timeout: int | None,
connection_class: type[_ConnectionT],
@ -342,7 +342,7 @@ class BlockingConnectionPool(ConnectionPool[_ConnectionT]):
) -> None: ...
@overload
def __init__(
self: BlockingConnectionPool[_ConnectionT],
self: BlockingConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780
max_connections: int = 50,
timeout: int | None = 20,
*,

View File

@ -1,2 +1,2 @@
version = "2024.4.16"
version = "2024.4.28"
upstream_repository = "https://github.com/mrabarnett/mrab-regex"

View File

@ -335,235 +335,237 @@ class Pattern(Generic[AnyStr]):
def search(
self: Pattern[str],
string: str,
pos: int = ...,
endpos: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> Match[str] | None: ...
@overload
def search(
self: Pattern[bytes],
string: ReadableBuffer,
pos: int = ...,
endpos: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> Match[bytes] | None: ...
@overload
def match(
self: Pattern[str],
string: str,
pos: int = ...,
endpos: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> Match[str] | None: ...
@overload
def match(
self: Pattern[bytes],
string: ReadableBuffer,
pos: int = ...,
endpos: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> Match[bytes] | None: ...
@overload
def fullmatch(
self: Pattern[str],
string: str,
pos: int = ...,
endpos: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> Match[str] | None: ...
@overload
def fullmatch(
self: Pattern[bytes],
string: ReadableBuffer,
pos: int = ...,
endpos: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> Match[bytes] | None: ...
@overload
def split(
self: Pattern[str], string: str, maxsplit: int = ..., concurrent: bool | None = ..., timeout: float | None = ...
self: Pattern[str], string: str, maxsplit: int = 0, concurrent: bool | None = None, timeout: float | None = None
) -> list[str | Any]: ...
@overload
def split(
self: Pattern[bytes],
string: ReadableBuffer,
maxsplit: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
maxsplit: int = 0,
concurrent: bool | None = None,
timeout: float | None = None,
) -> list[bytes | Any]: ...
@overload
def splititer(
self: Pattern[str], string: str, maxsplit: int = ..., concurrent: bool | None = ..., timeout: float | None = ...
self: Pattern[str], string: str, maxsplit: int = 0, concurrent: bool | None = None, timeout: float | None = None
) -> _regex.Splitter[str]: ...
@overload
def splititer(
self: Pattern[bytes],
string: ReadableBuffer,
maxsplit: int = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
maxsplit: int = 0,
concurrent: bool | None = None,
timeout: float | None = None,
) -> _regex.Splitter[bytes]: ...
@overload
def findall(
self: Pattern[str],
string: str,
pos: int = ...,
endpos: int = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
overlapped: bool = False,
concurrent: bool | None = None,
timeout: float | None = None,
) -> list[Any]: ...
@overload
def findall(
self: Pattern[bytes],
string: ReadableBuffer,
pos: int = ...,
endpos: int = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
overlapped: bool = False,
concurrent: bool | None = None,
timeout: float | None = None,
) -> list[Any]: ...
@overload
def finditer(
self: Pattern[str],
string: str,
pos: int = ...,
endpos: int = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
overlapped: bool = False,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> _regex.Scanner[str]: ...
@overload
def finditer(
self: Pattern[bytes],
string: ReadableBuffer,
pos: int = ...,
endpos: int = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
overlapped: bool = False,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> _regex.Scanner[bytes]: ...
@overload
def sub(
self: Pattern[str],
repl: str | Callable[[Match[str]], str],
string: str,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> str: ...
@overload
def sub(
self: Pattern[bytes],
repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer],
string: ReadableBuffer,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> bytes: ...
@overload
def subf(
self: Pattern[str],
format: str | Callable[[Match[str]], str],
string: str,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> str: ...
@overload
def subf(
self: Pattern[bytes],
format: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer],
string: ReadableBuffer,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> bytes: ...
@overload
def subn(
self: Pattern[str],
repl: str | Callable[[Match[str]], str],
string: str,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> tuple[str, int]: ...
@overload
def subn(
self: Pattern[bytes],
repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer],
string: ReadableBuffer,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> tuple[bytes, int]: ...
@overload
def subfn(
self: Pattern[str],
format: str | Callable[[Match[str]], str],
string: str,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> tuple[str, int]: ...
@overload
def subfn(
self: Pattern[bytes],
format: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer],
string: ReadableBuffer,
count: int = ...,
flags: int = ...,
pos: int | None = ...,
endpos: int | None = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
count: int = 0,
pos: int | None = None,
endpos: int | None = None,
concurrent: bool | None = None,
timeout: float | None = None,
) -> tuple[bytes, int]: ...
@overload
def scanner(
self: Pattern[str],
string: str,
pos: int | None = ...,
endpos: int | None = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
overlapped: bool = False,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> _regex.Scanner[str]: ...
@overload
def scanner(
self: Pattern[bytes],
string: bytes,
pos: int | None = ...,
endpos: int | None = ...,
overlapped: bool = ...,
concurrent: bool | None = ...,
timeout: float | None = ...,
pos: int | None = None,
endpos: int | None = None,
overlapped: bool = False,
concurrent: bool | None = None,
partial: bool = False,
timeout: float | None = None,
) -> _regex.Scanner[bytes]: ...
def __copy__(self) -> Self: ...
def __deepcopy__(self) -> Self: ...

View File

@ -2,23 +2,17 @@ import builtins
import operator
import types
import unittest
from _typeshed import IdentityFunction, Unused, _KT_contra, _VT_co
from _typeshed import IdentityFunction, SupportsGetItem, Unused
from builtins import next as next
from collections.abc import Callable, ItemsView, Iterable, Iterator as _Iterator, KeysView, Mapping, ValuesView
from functools import wraps as wraps
from importlib.util import spec_from_loader as spec_from_loader
from io import BytesIO as BytesIO, StringIO as StringIO
from re import Pattern
from typing import Any, AnyStr, Literal, NoReturn, Protocol, TypeVar, overload
from typing import Any, AnyStr, Literal, NoReturn, TypeVar, overload
from six import moves as moves
# TODO: We should switch to the _typeshed version of SupportsGetItem
# once mypy updates its vendored copy of typeshed and makes a new release
class _SupportsGetItem(Protocol[_KT_contra, _VT_co]):
def __contains__(self, x: Any, /) -> bool: ...
def __getitem__(self, key: _KT_contra, /) -> _VT_co: ...
_T = TypeVar("_T")
_K = TypeVar("_K")
_V = TypeVar("_V")
@ -68,7 +62,7 @@ unichr = chr
def int2byte(i: int) -> bytes: ...
# Should be `byte2int: operator.itemgetter[int]`. But a bug in mypy prevents using TypeVar in itemgetter.__call__
def byte2int(obj: _SupportsGetItem[int, _T]) -> _T: ...
def byte2int(obj: SupportsGetItem[int, _T]) -> _T: ...
indexbytes = operator.getitem
iterbytes = iter

View File

@ -9,7 +9,4 @@ extra_description = """\
"""
[tool.stubtest]
# Run stubtest on MacOS as well, to check that the
# uWSGI-specific parts of stubtest_third_party.py
# also work there
platforms = ["linux", "darwin"]
platforms = ["linux"]

View File

@ -26,7 +26,7 @@ class postfork(Generic[_P, _T]):
@overload
def __init__(self: postfork[..., Any], f: int) -> None: ...
@overload
def __init__(self: postfork[_P, _T], f: Callable[_P, _T]) -> None: ...
def __init__(self: postfork[_P, _T], f: Callable[_P, _T]) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __call__(self, f: Callable[_P2, _T2], /) -> postfork[_P2, _T2]: ...
@overload
@ -70,7 +70,7 @@ class mulefunc(Generic[_P, _T]):
@overload
def __init__(self: mulefunc[..., Any], f: int) -> None: ...
@overload
def __init__(self: mulefunc[_P, _T], f: Callable[_P, _T]) -> None: ...
def __init__(self: mulefunc[_P, _T], f: Callable[_P, _T]) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
def real_call(self, *args: _P.args, **kwargs: _P.kwargs) -> None: ...
@overload
def __call__(self, f: Callable[_P2, _T2], /) -> mulefunc[_P2, _T2]: ...

View File

@ -0,0 +1,2 @@
version = "0.7.*"
upstream_repository = "https://github.com/matiasb/python-unidiff"

View File

@ -0,0 +1,12 @@
from unidiff.patch import (
DEFAULT_ENCODING as DEFAULT_ENCODING,
LINE_TYPE_ADDED as LINE_TYPE_ADDED,
LINE_TYPE_CONTEXT as LINE_TYPE_CONTEXT,
LINE_TYPE_REMOVED as LINE_TYPE_REMOVED,
Hunk as Hunk,
PatchedFile as PatchedFile,
PatchSet as PatchSet,
UnidiffParseError as UnidiffParseError,
)
VERSION: str

View File

@ -0,0 +1 @@
__version__: str

View File

@ -0,0 +1,24 @@
from re import Pattern
from typing import Final
RE_SOURCE_FILENAME: Pattern[str]
RE_TARGET_FILENAME: Pattern[str]
RE_DIFF_GIT_HEADER: Pattern[str]
RE_DIFF_GIT_HEADER_URI_LIKE: Pattern[str]
RE_DIFF_GIT_HEADER_NO_PREFIX: Pattern[str]
RE_DIFF_GIT_DELETED_FILE: Pattern[str]
RE_DIFF_GIT_NEW_FILE: Pattern[str]
RE_HUNK_HEADER: Pattern[str]
RE_HUNK_BODY_LINE: Pattern[str]
RE_HUNK_EMPTY_BODY_LINE: Pattern[str]
RE_NO_NEWLINE_MARKER: Pattern[str]
RE_BINARY_DIFF: Pattern[str]
DEFAULT_ENCODING: Final = "UTF-8"
DEV_NULL: Final = "/dev/null"
LINE_TYPE_ADDED: Final = "+"
LINE_TYPE_REMOVED: Final = "-"
LINE_TYPE_CONTEXT: Final = " "
LINE_TYPE_EMPTY: Final = ""
LINE_TYPE_NO_NEWLINE: Final = "\\"
LINE_VALUE_NO_NEWLINE: Final = " No newline at end of file"

View File

@ -0,0 +1 @@
class UnidiffParseError(Exception): ...

View File

@ -0,0 +1,115 @@
from _typeshed import StrPath
from collections.abc import Iterable
from typing import overload
from typing_extensions import Self
from unidiff.constants import (
DEFAULT_ENCODING as DEFAULT_ENCODING,
LINE_TYPE_ADDED as LINE_TYPE_ADDED,
LINE_TYPE_CONTEXT as LINE_TYPE_CONTEXT,
LINE_TYPE_REMOVED as LINE_TYPE_REMOVED,
)
from unidiff.errors import UnidiffParseError as UnidiffParseError
class Line:
source_line_no: int | None
target_line_no: int | None
diff_line_no: int | None
line_type: str
value: str
def __init__(
self,
value: str,
line_type: str,
source_line_no: int | None = None,
target_line_no: int | None = None,
diff_line_no: int | None = None,
) -> None: ...
def __eq__(self, other: Line) -> bool: ... # type: ignore[override]
@property
def is_added(self) -> bool: ...
@property
def is_removed(self) -> bool: ...
@property
def is_context(self) -> bool: ...
class PatchInfo(list[str]): ...
class Hunk(list[Line]):
source_start: int
source_length: int
target_start: int
target_length: int
section_header: str
def __init__(
self, src_start: int = 0, src_len: int | None = 0, tgt_start: int = 0, tgt_len: int | None = 0, section_header: str = ""
) -> None: ...
def append(self, line: Line) -> None: ...
@property
def added(self) -> int: ...
@property
def removed(self) -> int: ...
def is_valid(self) -> bool: ...
def source_lines(self) -> Iterable[Line]: ...
@property
def source(self) -> Iterable[str]: ...
def target_lines(self) -> Iterable[Line]: ...
@property
def target(self) -> Iterable[str]: ...
class PatchedFile(list[Hunk]):
patch_info: PatchInfo | None
source_file: str
source_timestamp: str | None
target_file: str
target_timestamp: str | None
is_binary_file: bool
def __init__(
self,
patch_info: PatchInfo | None = None,
source: str = "",
target: str = "",
source_timestamp: str | None = None,
target_timestamp: str | None = None,
is_binary_file: bool = False,
) -> None: ...
@property
def path(self) -> str: ...
@property
def added(self) -> int: ...
@property
def removed(self) -> int: ...
@property
def is_rename(self) -> bool: ...
@property
def is_added_file(self) -> bool: ...
@property
def is_removed_file(self) -> bool: ...
@property
def is_modified_file(self) -> bool: ...
class PatchSet(list[PatchedFile]):
@overload
def __init__(self, f: Iterable[str] | str, encoding: None = None, metadata_only: bool = False) -> None: ...
@overload
def __init__(self, f: Iterable[bytes] | bytes, encoding: str | None = None, metadata_only: bool = False) -> None: ...
@classmethod
def from_filename(
cls, filename: StrPath, encoding: str = "UTF-8", errors: str | None = None, newline: str | None = None
) -> Self: ...
@classmethod
@overload
def from_string(cls, data: str, encoding: None = None, errors: str | None = "strict") -> Self: ...
@classmethod
@overload
def from_string(cls, data: bytes, encoding: str | None = None, errors: str | None = "strict") -> Self: ...
@property
def added_files(self) -> list[PatchedFile]: ...
@property
def removed_files(self) -> list[PatchedFile]: ...
@property
def modified_files(self) -> list[PatchedFile]: ...
@property
def added(self) -> int: ...
@property
def removed(self) -> int: ...