Improve many __(a)exit__ annotations (#9696)

This commit is contained in:
Avasam
2023-02-25 16:50:30 -05:00
committed by GitHub
parent db821101b8
commit 52ec44fa58
45 changed files with 216 additions and 81 deletions

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed import Unused
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from typing import Any, NoReturn, overload
from typing_extensions import Literal, Self
@@ -80,7 +81,7 @@ class Client:
session_id: str | None = ...,
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
@property
def name(self) -> str: ...
@property

View File

@@ -1,4 +1,4 @@
from _typeshed import Incomplete, SupportsRead, SupportsWrite
from _typeshed import Incomplete, SupportsRead, SupportsWrite, Unused
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
from enum import IntEnum
from pathlib import Path
@@ -172,7 +172,7 @@ class Image:
@property
def size(self) -> tuple[int, int]: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def close(self) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __getstate__(self) -> _ImageState: ...

View File

@@ -1,4 +1,4 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Unused
from typing import Any, NoReturn
from typing_extensions import Self
@@ -42,7 +42,7 @@ class Parser:
decode: Any
def feed(self, data) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def close(self) -> Image: ...
class PyCodecState:

View File

@@ -1,6 +1,8 @@
import collections
from _typeshed import Incomplete
from types import TracebackType
from typing import Any
from typing_extensions import Literal
def encode_text(s: str) -> bytes: ...
@@ -95,7 +97,9 @@ class PdfParser:
mode: str = ...,
) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback): ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> Literal[False]: ...
def start_writing(self) -> None: ...
def close_buf(self) -> None: ...
def close(self) -> None: ...

View File

@@ -1,4 +1,4 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Unused
from enum import IntEnum
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -33,7 +33,7 @@ class ChunkStream:
def __init__(self, fp) -> None: ...
def read(self): ...
def __enter__(self): ...
def __exit__(self, *args) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def close(self) -> None: ...
def push(self, cid, pos, length) -> None: ...
def call(self, cid, pos, length): ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Unused
from typing import Any
from .ContainerIO import ContainerIO
@@ -6,5 +7,5 @@ class TarIO(ContainerIO):
fh: Any
def __init__(self, tarfile, file) -> None: ...
def __enter__(self): ...
def __exit__(self, *args) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def close(self) -> None: ...

View File

@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from collections.abc import MutableMapping
from numbers import Rational
from types import TracebackType
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -171,7 +172,9 @@ class AppendingTiffWriter:
def finalize(self) -> None: ...
def newFrame(self) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback): ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> Literal[False]: ...
def tell(self): ...
def seek(self, offset, whence=...): ...
def goToEnd(self) -> None: ...

View File

@@ -1,4 +1,5 @@
import abc
from types import TracebackType
class ReversibleProxy: ...
@@ -8,7 +9,9 @@ class StartableContext(abc.ABC, metaclass=abc.ABCMeta):
def __await__(self): ...
async def __aenter__(self): ...
@abc.abstractmethod
async def __aexit__(self, type_, value, traceback): ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
class ProxyComparable(ReversibleProxy):
def __hash__(self) -> int: ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from types import TracebackType
from typing import Any
from .base import ProxyComparable, StartableContext
@@ -39,7 +40,9 @@ class AsyncConnection(ProxyComparable, StartableContext, AsyncConnectable):
async def stream_scalars(self, statement, parameters: Incomplete | None = ..., execution_options=...): ...
async def run_sync(self, fn, *arg, **kw): ...
def __await__(self): ...
async def __aexit__(self, type_, value, traceback) -> None: ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
# proxied from Connection
dialect: Any
@property
@@ -55,7 +58,9 @@ class AsyncEngine(ProxyComparable, AsyncConnectable):
def __init__(self, conn) -> None: ...
transaction: Any
async def start(self, is_ctxmanager: bool = ...): ...
async def __aexit__(self, type_, value, traceback) -> None: ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
sync_engine: Any
def __init__(self, sync_engine) -> None: ...
def begin(self): ...
@@ -91,4 +96,6 @@ class AsyncTransaction(ProxyComparable, StartableContext):
async def rollback(self) -> None: ...
async def commit(self) -> None: ...
async def start(self, is_ctxmanager: bool = ...): ...
async def __aexit__(self, type_, value, traceback) -> None: ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from types import TracebackType
from typing import Any
from typing_extensions import Self
@@ -55,7 +56,9 @@ class AsyncSession(ReversibleProxy):
@classmethod
async def close_all(cls): ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, type_, value, traceback) -> None: ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
# proxied from Session
identity_map: Any
autoflush: Any
@@ -92,7 +95,9 @@ class _AsyncSessionContextManager:
def __init__(self, async_session) -> None: ...
trans: Any
async def __aenter__(self): ...
async def __aexit__(self, type_, value, traceback) -> None: ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
class AsyncSessionTransaction(ReversibleProxy, StartableContext):
session: Any
@@ -104,7 +109,9 @@ class AsyncSessionTransaction(ReversibleProxy, StartableContext):
async def rollback(self) -> None: ...
async def commit(self) -> None: ...
async def start(self, is_ctxmanager: bool = ...): ...
async def __aexit__(self, type_, value, traceback) -> None: ...
async def __aexit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def async_object_session(instance): ...
def async_session(session): ...

View File

@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from types import TracebackType
from typing import Any, TypeVar, overload
from typing_extensions import Self
@@ -107,7 +108,9 @@ class Session(_SessionClassMethods):
) -> None: ...
connection_callable: Any
def __enter__(self) -> Self: ...
def __exit__(self, type_, value, traceback) -> None: ...
def __exit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
@property
def transaction(self): ...
def in_transaction(self): ...

View File

@@ -1,3 +1,4 @@
from types import TracebackType
from typing import Any
class _AsyncGeneratorContextManager:
@@ -5,6 +6,8 @@ class _AsyncGeneratorContextManager:
__doc__: Any
def __init__(self, func, args, kwds) -> None: ...
async def __aenter__(self): ...
async def __aexit__(self, typ, value, traceback): ...
async def __aexit__(
self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> bool | None: ...
def asynccontextmanager(func): ...

View File

@@ -1,4 +1,5 @@
import asyncio as asyncio
from _typeshed import Unused
from collections.abc import Callable, Coroutine
from typing import Any
@@ -13,6 +14,6 @@ class AsyncAdaptedLock:
@memoized_property
def mutex(self): ...
def __enter__(self): ...
def __exit__(self, *arg, **kw) -> None: ...
def __exit__(self, *arg: Unused, **kw: Unused) -> None: ...
def get_event_loop(): ...

View File

@@ -5,7 +5,7 @@ import itertools
import operator
import pickle as pickle
import threading as threading
from _typeshed import Incomplete
from _typeshed import Incomplete, Unused
from abc import ABC as ABC
from datetime import timezone as timezone
from functools import reduce as reduce
@@ -53,7 +53,7 @@ class nullcontext:
enter_result: Any
def __init__(self, enter_result: Incomplete | None = ...) -> None: ...
def __enter__(self): ...
def __exit__(self, *excinfo) -> None: ...
def __exit__(self, *excinfo: Unused) -> None: ...
def inspect_getfullargspec(func): ...
def importlib_metadata_get(group): ...

View File

@@ -1,5 +1,6 @@
from _typeshed import Incomplete, Unused
from collections.abc import Callable
from types import TracebackType
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Self
@@ -13,7 +14,9 @@ class safe_reraise:
warn_only: Any
def __init__(self, warn_only: bool = ...) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, type_, value, traceback) -> None: ...
def __exit__(
self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def walk_subclasses(cls) -> None: ...
def string_or_unprintable(element): ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from types import TracebackType
from .models.segment import SegmentContextManager as SegmentContextManager
from .models.subsegment import (
@@ -11,12 +12,16 @@ from .utils import stacktrace as stacktrace
class AsyncSegmentContextManager(SegmentContextManager):
async def __aenter__(self): ...
async def __aexit__(self, exc_type, exc_val, exc_tb): ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class AsyncSubsegmentContextManager(SubsegmentContextManager):
async def __call__(self, wrapped, instance, args, kwargs): ...
async def __aenter__(self): ...
async def __aexit__(self, exc_type, exc_val, exc_tb): ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class AsyncAWSXRayRecorder(AWSXRayRecorder):
def capture_async(self, name: Incomplete | None = ...): ...

View File

@@ -1,3 +1,4 @@
from types import TracebackType
from typing import Any
from ..exceptions.exceptions import SegmentNameMissingException as SegmentNameMissingException
@@ -16,7 +17,9 @@ class SegmentContextManager:
segment: Segment
def __init__(self, recorder: AWSXRayRecorder, name: str | None = ..., **segment_kwargs) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class Segment(Entity):
trace_id: str | None

View File

@@ -1,5 +1,6 @@
import time
from _typeshed import Incomplete
from types import TracebackType
from typing import Any
from ...core import AWSXRayRecorder
@@ -21,7 +22,9 @@ class SubsegmentContextManager:
def __init__(self, recorder: AWSXRayRecorder, name: Incomplete | None = ..., **subsegment_kwargs) -> None: ...
def __call__(self, wrapped, instance, args: list[Any], kwargs: dict[str, Any]): ...
def __enter__(self) -> Subsegment: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class Subsegment(Entity):
parent_segment: Segment

View File

@@ -1,4 +1,4 @@
from _typeshed import IdentityFunction
from _typeshed import IdentityFunction, Unused
from collections.abc import Callable, Iterator, MutableMapping, Sequence
from contextlib import AbstractContextManager
from typing import Any, Generic, TypeVar, overload
@@ -66,7 +66,7 @@ class _TimedCache(Cache[_KT, _VT]):
def __init__(self, timer: Callable[[], float]) -> None: ...
def __call__(self) -> float: ...
def __enter__(self) -> float: ...
def __exit__(self, *exc: object) -> None: ...
def __exit__(self, *exc: Unused) -> None: ...
@property
def timer(self) -> _Timer: ...

View File

@@ -1,4 +1,5 @@
from collections.abc import Iterable, Mapping
from types import TracebackType
from typing import Any
from typing_extensions import Self, TypeAlias
from urllib.parse import ParseResult, SplitResult
@@ -50,7 +51,9 @@ class DAVClient:
ssl_cert: str | tuple[str, str] | None = ...,
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def principal(self, *, url: str | ParseResult | SplitResult | URL | None = ...) -> Principal: ...
def calendar(
self,

View File

@@ -69,7 +69,7 @@ class _CDataBase:
def __dir__(self): ...
def __enter__(self): ...
def __eq__(self, other): ...
def __exit__(self, type, value, traceback): ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None): ...
def __float__(self) -> float: ...
def __ge__(self, other): ...
def __getitem__(self, index): ...

View File

@@ -65,7 +65,7 @@ class MockedProgram(CustomSearchPath):
program_signal_file: Any
def __init__(self, name, returncode: int = ..., script: Incomplete | None = ...) -> None: ...
def __enter__(self): ...
def __exit__(self, *args, **kw): ...
def __exit__(self, *args: object, **kw: object): ...
class CaptureOutput(ContextManager):
stdin: Any

View File

@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from collections.abc import Generator
from enum import Enum
from types import TracebackType
from typing_extensions import Self
from influxdb_client.client.flux_table import TableList
@@ -46,9 +47,13 @@ class FluxCsvParser:
response_metadata_mode: FluxResponseMetadataMode = ...,
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def generator(self) -> Generator[Incomplete, None, None]: ...
def generator_async(self): ...
def parse_record(self, table_index, table, csv): ...

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from types import TracebackType
from typing_extensions import Self
from influxdb_client import HealthCheck, InvokableScriptsApi, Ready
@@ -43,7 +44,9 @@ class InfluxDBClient(_BaseClient):
profilers: Incomplete | None = ...,
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
@classmethod
def from_config_file(cls, config_file: str = ..., debug: Incomplete | None = ..., enable_gzip: bool = ..., **kwargs): ...
@classmethod

View File

@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from types import TracebackType
from typing_extensions import Self
from influxdb_client.client._base import _BaseClient
@@ -37,7 +38,9 @@ class InfluxDBClientAsync(_BaseClient):
profilers: Incomplete | None = ...,
) -> None: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type: object, exc: object, tb: object) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> None: ...
async def close(self) -> None: ...
@classmethod
def from_config_file(cls, config_file: str = ..., debug: Incomplete | None = ..., enable_gzip: bool = ..., **kwargs): ...

View File

@@ -1,5 +1,6 @@
import multiprocessing
from _typeshed import Incomplete
from types import TracebackType
logger: Incomplete
@@ -18,5 +19,7 @@ class MultiprocessingWriter(multiprocessing.Process):
def start(self) -> None: ...
def terminate(self) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __del__(self) -> None: ...

View File

@@ -1,4 +1,5 @@
from collections.abc import Iterable, Mapping
from types import TracebackType
from typing import Any, TextIO, overload
from typing_extensions import Literal, TypeAlias
@@ -194,7 +195,9 @@ class Promise(Result):
def __init__(self, runner) -> None: ...
def join(self): ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def normalize_hide(val, out_stream=..., err_stream=...): ...
def default_encoding() -> str: ...

View File

@@ -29,7 +29,7 @@ class BaseCursor:
def __init__(self, connection) -> None: ...
def close(self) -> None: ...
def __enter__(self): ...
def __exit__(self, *exc_info) -> None: ...
def __exit__(self, *exc_info: object) -> None: ...
def nextset(self): ...
def setinputsizes(self, *args) -> None: ...
def setoutputsizes(self, *args) -> None: ...

View File

@@ -3,6 +3,7 @@ import logging
import threading
from _typeshed import Incomplete, SupportsKeysAndGetItem
from collections.abc import Generator, Iterable
from types import TracebackType
from typing import ClassVar, NamedTuple, TypeVar
from typing_extensions import Self
@@ -93,7 +94,9 @@ class Context:
scope_cte: Incomplete
scope_column: Incomplete
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def push_alias(self) -> Generator[None, None, None]: ...
def sql(self, obj): ...
def literal(self, keyword): ...
@@ -162,7 +165,9 @@ class _BoundTableContext(_callable_context_manager):
database: Incomplete
def __init__(self, table, database) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class Table(_HashableSource, BaseTable):
__name__: Incomplete
@@ -692,7 +697,9 @@ class ExceptionWrapper:
exceptions: Incomplete
def __init__(self, exceptions) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
class IndexMetadata(NamedTuple):
name: Incomplete
@@ -732,13 +739,17 @@ class _ConnectionLocal(_ConnectionState, threading.local): ...
class _NoopLock:
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class ConnectionContext(_callable_context_manager):
db: Incomplete
def __init__(self, db) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class Database(_callable_context_manager):
context_class: Incomplete
@@ -778,7 +789,9 @@ class Database(_callable_context_manager):
deferred: Incomplete
def init(self, database, **kwargs) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def connection_context(self): ...
def connect(self, reuse_if_open: bool = ...): ...
def close(self): ...
@@ -972,13 +985,15 @@ class _manual(_callable_context_manager):
db: Incomplete
def __init__(self, db) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class _atomic(_callable_context_manager):
db: Incomplete
def __init__(self, db, *args, **kwargs) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb): ...
def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None): ...
class _transaction(_callable_context_manager):
db: Incomplete
@@ -986,7 +1001,9 @@ class _transaction(_callable_context_manager):
def commit(self, begin: bool = ...) -> None: ...
def rollback(self, begin: bool = ...) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class _savepoint(_callable_context_manager):
db: Incomplete
@@ -996,7 +1013,9 @@ class _savepoint(_callable_context_manager):
def commit(self, begin: bool = ...) -> None: ...
def rollback(self) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class CursorWrapper:
cursor: Incomplete
@@ -1554,7 +1573,9 @@ class _BoundModelsContext(_callable_context_manager):
bind_backrefs: Incomplete
def __init__(self, models, database, bind_refs, bind_backrefs) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class Model(metaclass=ModelBase):
__data__: Incomplete

View File

@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Unused
from collections.abc import Generator, Sequence
from types import TracebackType
from typing import NamedTuple
from typing_extensions import Self
@@ -16,7 +17,7 @@ class _CallbackResult:
def __bool__(self) -> bool: ...
__nonzero__: Incomplete
def __enter__(self): ...
def __exit__(self, *args, **kwargs) -> None: ...
def __exit__(self, *args: Unused, **kwargs: Unused) -> None: ...
def is_ready(self): ...
@property
def ready(self): ...
@@ -31,7 +32,7 @@ class _CallbackResult:
class _IoloopTimerContext:
def __init__(self, duration, connection) -> None: ...
def __enter__(self): ...
def __exit__(self, *_args, **_kwargs) -> None: ...
def __exit__(self, *_args: Unused, **_kwargs: Unused) -> None: ...
def is_ready(self): ...
class _TimerEvt:
@@ -57,7 +58,9 @@ class BlockingConnection:
self, parameters: Parameters | Sequence[Parameters] | None = ..., _impl_class: Incomplete | None = ...
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: object, value: object, traceback: object) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def add_on_connection_blocked_callback(self, callback) -> None: ...
def add_on_connection_unblocked_callback(self, callback) -> None: ...
def call_later(self, delay, callback): ...
@@ -160,7 +163,9 @@ class BlockingChannel:
def __init__(self, channel_impl, connection) -> None: ...
def __int__(self) -> int: ...
def __enter__(self): ...
def __exit__(self, exc_type, value, traceback) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
@property
def channel_number(self): ...
@property

View File

@@ -218,7 +218,7 @@ class Process:
class Popen(Process):
def __init__(self, *args, **kwargs) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args, **kwargs) -> None: ...
def __exit__(self, *args: object, **kwargs: object) -> None: ...
def __getattribute__(self, name: str) -> Any: ...
def pids() -> list[int]: ...

View File

@@ -462,7 +462,7 @@ class connection:
def tpc_rollback(self, __xid: str | bytes | Xid = ...) -> None: ...
def xid(self, format_id, gtrid, bqual) -> Xid: ...
def __enter__(self) -> Self: ...
def __exit__(self, __type: object, __name: object, __tb: object) -> None: ...
def __exit__(self, __type: type[BaseException] | None, __name: BaseException | None, __tb: TracebackType | None) -> None: ...
class lobject:
closed: Any

View File

@@ -1,6 +1,7 @@
import threading
from _typeshed import ReadableBuffer
from collections.abc import Callable
from types import TracebackType
from typing_extensions import Self
from serial import Serial
@@ -42,4 +43,6 @@ class ReaderThread(threading.Thread):
def close(self) -> None: ...
def connect(self) -> tuple[Self, Protocol]: ...
def __enter__(self) -> Protocol: ...
def __exit__(self, __exc_type: object, __exc_val: object, __exc_tb: object) -> None: ...
def __exit__(
self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
) -> None: ...

View File

@@ -1,6 +1,7 @@
import codecs
import sys
import threading
from _typeshed import Unused
from collections.abc import Iterable
from typing import Any, BinaryIO, TextIO
from typing_extensions import Self
@@ -20,7 +21,7 @@ class ConsoleBase:
def write(self, text: str) -> None: ...
def cancel(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object, **kwargs: object) -> None: ...
def __exit__(self, *args: Unused, **kwargs: Unused) -> None: ...
if sys.platform == "win32":
class Out:

View File

@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Unused
from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Mapping, MutableMapping, Sequence
from datetime import datetime, timedelta
from types import TracebackType
from typing import Any, ClassVar, Generic, NoReturn, Protocol, overload
from typing_extensions import Literal, Self, TypeAlias, TypedDict
@@ -93,7 +94,9 @@ class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], Asy
def monitor(self) -> Monitor: ...
def client(self) -> Redis[_StrType]: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type, exc_value, traceback) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __del__(self, _warnings: Any = ...) -> None: ...
async def close(self, close_connection_pool: bool | None = ...) -> None: ...
async def execute_command(self, *args, **options): ...
@@ -117,7 +120,7 @@ class Monitor:
def __init__(self, connection_pool: ConnectionPool) -> None: ...
async def connect(self) -> None: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, *args) -> None: ...
async def __aexit__(self, *args: Unused) -> None: ...
async def next_command(self) -> MonitorCommandInfo: ...
def listen(self) -> AsyncIterator[MonitorCommandInfo]: ...
@@ -143,7 +146,9 @@ class PubSub:
encoder: Incomplete | None = ...,
) -> None: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type, exc_value, traceback) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __del__(self) -> None: ...
async def reset(self) -> None: ...
def close(self) -> Awaitable[NoReturn]: ...
@@ -192,7 +197,9 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
shard_hint: str | None,
) -> None: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type, exc_value, traceback) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __await__(self): ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...

View File

@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Awaitable, Callable, Mapping
from types import TracebackType
from typing import Any, Generic
from typing_extensions import Self
@@ -76,7 +77,9 @@ class RedisCluster(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # T
async def initialize(self) -> Self: ...
async def close(self) -> None: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __await__(self) -> Awaitable[Self]: ...
def __del__(self) -> None: ...
async def on_connect(self, connection: Connection) -> None: ...
@@ -146,10 +149,14 @@ class ClusterPipeline(AbstractRedis, AbstractRedisCluster, Generic[_StrType]):
def __init__(self, client: RedisCluster[_StrType]) -> None: ...
async def initialize(self) -> Self: ...
async def __aenter__(self) -> Self: ...
async def __aexit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __await__(self) -> Awaitable[Self]: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __bool__(self) -> bool: ...
def __len__(self) -> int: ...
def execute_command(self, *args: KeyT | EncodableT, **kwargs: Any) -> Self: ...

View File

@@ -1,3 +1,4 @@
from types import TracebackType
from typing import Any, Generic
from redis.asyncio.client import Pipeline, Redis
@@ -9,4 +10,6 @@ class pipeline(Generic[_StrType]):
p: Pipeline[_StrType]
def __init__(self, redis_obj: Redis[_StrType]) -> None: ...
async def __aenter__(self) -> Pipeline[_StrType]: ...
async def __aexit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...

View File

@@ -1,5 +1,5 @@
import threading
from _typeshed import Incomplete, SupportsItems
from _typeshed import Incomplete, SupportsItems, Unused
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from datetime import datetime, timedelta
from re import Pattern
@@ -314,7 +314,9 @@ class Redis(AbstractRedis, RedisModuleCommands, CoreCommands[_StrType], Sentinel
def parse_response(self, connection, command_name, **options: _ParseResponseOptions): ...
def monitor(self) -> Monitor: ...
def __enter__(self) -> Redis[_StrType]: ...
def __exit__(self, exc_type, exc_value, traceback): ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __del__(self) -> None: ...
def close(self) -> None: ...
def client(self) -> Redis[_StrType]: ...
@@ -390,7 +392,9 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
explicit_transaction: Any
def __init__(self, connection_pool, response_callbacks, transaction, shard_hint) -> None: ...
def __enter__(self) -> Pipeline[_StrType]: ... # type: ignore[override]
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __del__(self) -> None: ...
def __len__(self) -> int: ...
def __bool__(self) -> bool: ...
@@ -727,6 +731,6 @@ class Monitor:
monitor_re: Pattern[str]
def __init__(self, connection_pool) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def next_command(self) -> dict[str, Any]: ...
def listen(self) -> Iterable[dict[str, Any]]: ...

View File

@@ -1,4 +1,5 @@
import datetime
from _typeshed import Unused
from collections.abc import Callable, Iterator
from json import JSONDecoder
from typing import Any
@@ -107,7 +108,7 @@ class Response:
def __nonzero__(self) -> bool: ...
def __iter__(self) -> Iterator[bytes]: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
@property
def next(self) -> PreparedRequest | None: ...
@property

View File

@@ -1,4 +1,4 @@
from _typeshed import Incomplete, SupportsItems, SupportsRead
from _typeshed import Incomplete, SupportsItems, SupportsRead, Unused
from collections.abc import Callable, Iterable, Mapping, MutableMapping
from typing import Any
from typing_extensions import Self, TypeAlias, TypedDict
@@ -134,7 +134,7 @@ class Session(SessionRedirectMixin):
redirect_cache: RecentlyUsedContainer[Any, Any]
def __init__(self) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def prepare_request(self, request: Request) -> PreparedRequest: ...
def request(
self,

View File

@@ -1,5 +1,7 @@
from distutils.errors import DistutilsError
from types import TracebackType
from typing import Any
from typing_extensions import Literal
class UnpickleableException(Exception):
@staticmethod
@@ -7,14 +9,18 @@ class UnpickleableException(Exception):
class ExceptionSaver:
def __enter__(self): ...
def __exit__(self, type, exc, tb): ...
def __exit__(
self, type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
) -> Literal[True] | None: ...
def resume(self) -> None: ...
def run_setup(setup_script, args): ...
class AbstractSandbox:
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_value, traceback) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def run(self, func): ...
class DirectorySandbox(AbstractSandbox):

View File

@@ -17,7 +17,7 @@ class _Callback:
finish: Incomplete | None,
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args) -> None: ...
def __exit__(self, *args: object) -> None: ...
def register(self) -> None: ...
def unregister(self) -> None: ...

View File

@@ -1,6 +1,7 @@
import contextlib
from _typeshed import Incomplete, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping
from types import TracebackType
from typing import Any, ClassVar, Generic, NoReturn, TypeVar, overload
from typing_extensions import Literal, Self
@@ -200,7 +201,9 @@ class tqdm(Generic[_T], Iterable[_T], Comparable):
def __reversed__(self) -> Iterator[_T]: ...
def __contains__(self, item: object) -> bool: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __del__(self) -> None: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...

View File

@@ -1,4 +1,5 @@
from collections.abc import MutableMapping
from types import TracebackType
from typing import Any, NoReturn, TypeVar
_KT = TypeVar("_KT")
@@ -6,7 +7,9 @@ _VT = TypeVar("_VT")
class RLock:
def __enter__(self): ...
def __exit__(self, exc_type, exc_value, traceback): ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
class RecentlyUsedContainer(MutableMapping[_KT, _VT]):
ContainerCls: Any

View File

@@ -1,4 +1,6 @@
from types import TracebackType
from typing import Any
from typing_extensions import Literal
from .request import RequestMethods
@@ -8,7 +10,9 @@ class PoolManager(RequestMethods):
pools: Any
def __init__(self, num_pools=..., headers=..., **connection_pool_kw) -> None: ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb): ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> Literal[False]: ...
def clear(self): ...
def connection_from_host(self, host, port=..., scheme=...): ...
def connection_from_url(self, url): ...