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,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: ...