From fb05d3e8ac6fc67b3951021dd2c2363896b5e2a5 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Thu, 9 May 2019 14:32:52 +0100 Subject: [PATCH 1/2] Add an optional opener paratemer to open() function --- stdlib/2/__builtin__.pyi | 7 ++++++- stdlib/2and3/builtins.pyi | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index a4d6b03625f4..48d4a1421daf 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1315,7 +1315,12 @@ def oct(__i: int) -> str: ... # TODO __index__ if sys.version_info >= (3, 6): def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ... + errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... +elif sys.version_info >= (3, 3): + def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., + errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... elif sys.version_info >= (3,): def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index a4d6b03625f4..48d4a1421daf 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -1315,7 +1315,12 @@ def oct(__i: int) -> str: ... # TODO __index__ if sys.version_info >= (3, 6): def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ... + errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... +elif sys.version_info >= (3, 3): + def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., + errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., + opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... elif sys.version_info >= (3,): def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ... From 7d7f96e637b90039525456aa57f34ea0ee3f2be2 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Thu, 9 May 2019 15:31:23 +0100 Subject: [PATCH 2/2] Remove Python 3.3 support --- stdlib/2/__builtin__.pyi | 5 +---- stdlib/2and3/builtins.pyi | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 48d4a1421daf..8ac0056f938c 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1317,13 +1317,10 @@ if sys.version_info >= (3, 6): def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... -elif sys.version_info >= (3, 3): +elif sys.version_info >= (3,): def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... -elif sys.version_info >= (3,): - def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ... else: def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 48d4a1421daf..8ac0056f938c 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -1317,13 +1317,10 @@ if sys.version_info >= (3, 6): def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... -elif sys.version_info >= (3, 3): +elif sys.version_info >= (3,): def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ..., opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ... -elif sys.version_info >= (3,): - def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ..., - errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...) -> IO[Any]: ... else: def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...