fix type of FileIO.__init__ opener kwarg (#5738)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Thomas Grainger
2021-07-08 21:50:56 +01:00
committed by GitHub
parent 0085539df3
commit c968614bae

View File

@@ -1,7 +1,8 @@
import builtins
import codecs
import sys
from _typeshed import ReadableBuffer, Self, WriteableBuffer
from _typeshed import ReadableBuffer, Self, StrOrBytesPath, WriteableBuffer
from os import _Opener
from types import TracebackType
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, List, Optional, TextIO, Tuple, Type, Union
@@ -64,14 +65,9 @@ class BufferedIOBase(IOBase):
class FileIO(RawIOBase, BinaryIO):
mode: str
# Technically this is whatever is passed in as file, either a str, a bytes, or an int.
name: Union[int, str] # type: ignore
name: StrOrBytesPath | int # type: ignore
def __init__(
self,
file: Union[str, bytes, int],
mode: str = ...,
closefd: bool = ...,
opener: Optional[Callable[[Union[int, str], str], int]] = ...,
self, file: StrOrBytesPath | int, mode: str = ..., closefd: bool = ..., opener: _Opener | None = ...
) -> None: ...
@property
def closefd(self) -> bool: ...