Use _typeshed.Self with __enter__ (#5712)

This commit is contained in:
Anton Grübel
2021-06-30 00:19:25 +02:00
committed by GitHub
parent 35cc7491db
commit c38171a0b3
8 changed files with 24 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
import _compression
import sys
from _compression import BaseStream
from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer
from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
from typing import IO, Any, Iterable, List, Optional, Protocol, TextIO, TypeVar, Union, overload
from typing_extensions import Literal, SupportsIndex
@@ -82,7 +82,7 @@ def open(
) -> TextIO: ...
class BZ2File(BaseStream, IO[bytes]):
def __enter__(self: _T) -> _T: ...
def __enter__(self: Self) -> Self: ...
if sys.version_info >= (3, 9):
@overload
def __init__(self, filename: _WritableFileobj, mode: _WriteBinaryMode, *, compresslevel: int = ...) -> None: ...