From d0c1639c713152c0ede7a00b851304b079455af3 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Fri, 15 Sep 2023 11:08:54 +0300 Subject: [PATCH 1/2] Make all protocols' param names pos-only in codecs.pyi --- stdlib/codecs.pyi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index c9b6a4a82da6..533f6b3f763e 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -78,22 +78,22 @@ class _Stream(_WritableStream, _ReadableStream, Protocol): ... # They were much more common in Python 2 than in Python 3. class _Encoder(Protocol): - def __call__(self, input: str, errors: str = ...) -> tuple[bytes, int]: ... # signature of Codec().encode + def __call__(self, __input: str, __errors: str = ...) -> tuple[bytes, int]: ... # signature of Codec().encode class _Decoder(Protocol): - def __call__(self, input: bytes, errors: str = ...) -> tuple[str, int]: ... # signature of Codec().decode + def __call__(self, __input: bytes, __errors: str = ...) -> tuple[str, int]: ... # signature of Codec().decode class _StreamReader(Protocol): - def __call__(self, stream: _ReadableStream, errors: str = ...) -> StreamReader: ... + def __call__(self, __stream: _ReadableStream, __errors: str = ...) -> StreamReader: ... class _StreamWriter(Protocol): - def __call__(self, stream: _WritableStream, errors: str = ...) -> StreamWriter: ... + def __call__(self, __stream: _WritableStream, __errors: str = ...) -> StreamWriter: ... class _IncrementalEncoder(Protocol): - def __call__(self, errors: str = ...) -> IncrementalEncoder: ... + def __call__(self, __errors: str = ...) -> IncrementalEncoder: ... class _IncrementalDecoder(Protocol): - def __call__(self, errors: str = ...) -> IncrementalDecoder: ... + def __call__(self, __errors: str = ...) -> IncrementalDecoder: ... class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): _is_text_encoding: bool From c5c690626c47f1a746b5b60abce33b2f71423b45 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 16 Sep 2023 13:39:41 +0300 Subject: [PATCH 2/2] Address review --- stdlib/codecs.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index 533f6b3f763e..f8c92392a599 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -90,10 +90,10 @@ class _StreamWriter(Protocol): def __call__(self, __stream: _WritableStream, __errors: str = ...) -> StreamWriter: ... class _IncrementalEncoder(Protocol): - def __call__(self, __errors: str = ...) -> IncrementalEncoder: ... + def __call__(self, errors: str = ...) -> IncrementalEncoder: ... class _IncrementalDecoder(Protocol): - def __call__(self, __errors: str = ...) -> IncrementalDecoder: ... + def __call__(self, errors: str = ...) -> IncrementalDecoder: ... class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): _is_text_encoding: bool