From b94d23c608c5ad72a29e728cbd90d58cf4db9f9b Mon Sep 17 00:00:00 2001 From: Shantanu Date: Sat, 29 Feb 2020 05:42:04 -0800 Subject: [PATCH] struct: fix arg names, mark positional-only args (#3792) --- stdlib/2and3/struct.pyi | 12 ++++++------ tests/stubtest_whitelists/py37.txt | 4 ---- tests/stubtest_whitelists/py38.txt | 6 ------ 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/stdlib/2and3/struct.pyi b/stdlib/2and3/struct.pyi index 552ee227d..c672b924f 100644 --- a/stdlib/2and3/struct.pyi +++ b/stdlib/2and3/struct.pyi @@ -20,12 +20,12 @@ else: def pack(fmt: _FmtType, *v: Any) -> bytes: ... def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... -def unpack(fmt: _FmtType, buffer: _BufferType) -> Tuple[Any, ...]: ... -def unpack_from(fmt: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... +def unpack(__format: _FmtType, __buffer: _BufferType) -> Tuple[Any, ...]: ... +def unpack_from(__format: _FmtType, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... if sys.version_info >= (3, 4): - def iter_unpack(fmt: _FmtType, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ... + def iter_unpack(__format: _FmtType, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ... -def calcsize(fmt: _FmtType) -> int: ... +def calcsize(__format: _FmtType) -> int: ... class Struct: if sys.version_info >= (3, 7): @@ -38,7 +38,7 @@ class Struct: def pack(self, *v: Any) -> bytes: ... def pack_into(self, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ... - def unpack(self, buffer: _BufferType) -> Tuple[Any, ...]: ... + def unpack(self, __buffer: _BufferType) -> Tuple[Any, ...]: ... def unpack_from(self, buffer: _BufferType, offset: int = ...) -> Tuple[Any, ...]: ... if sys.version_info >= (3, 4): - def iter_unpack(self, buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ... + def iter_unpack(self, __buffer: _BufferType) -> Iterator[Tuple[Any, ...]]: ... diff --git a/tests/stubtest_whitelists/py37.txt b/tests/stubtest_whitelists/py37.txt index 8611d110a..7866eb214 100644 --- a/tests/stubtest_whitelists/py37.txt +++ b/tests/stubtest_whitelists/py37.txt @@ -85,10 +85,6 @@ queue.SimpleQueue.__init__ secrets.SystemRandom.getstate smtplib.SMTP.sendmail sre_constants.RANGE_IGNORE -struct.calcsize -struct.iter_unpack -struct.unpack -struct.unpack_from time.CLOCK_PROF time.CLOCK_UPTIME tkinter.Menu.tk_bindForTraversal diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index e857dcadf..9d52da2ad 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -169,12 +169,6 @@ statistics.NormalDist.samples string.Formatter.format string.Template.safe_substitute string.Template.substitute -struct.Struct.iter_unpack -struct.Struct.unpack -struct.calcsize -struct.iter_unpack -struct.unpack -struct.unpack_from sys.UnraisableHookArgs threading.ExceptHookArgs time.CLOCK_PROF