From 1a1970d95002c080406a94248412d056f6490596 Mon Sep 17 00:00:00 2001 From: Brian Schubert Date: Mon, 4 Nov 2024 16:38:17 -0500 Subject: [PATCH] Update `getopt` to accept any iterable for `longopts` (#12950) --- stdlib/getopt.pyi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stdlib/getopt.pyi b/stdlib/getopt.pyi index bc9d4da4796b..bcc8d9750b19 100644 --- a/stdlib/getopt.pyi +++ b/stdlib/getopt.pyi @@ -1,7 +1,11 @@ +from collections.abc import Iterable + __all__ = ["GetoptError", "error", "getopt", "gnu_getopt"] -def getopt(args: list[str], shortopts: str, longopts: list[str] = []) -> tuple[list[tuple[str, str]], list[str]]: ... -def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = []) -> tuple[list[tuple[str, str]], list[str]]: ... +def getopt(args: list[str], shortopts: str, longopts: Iterable[str] | str = []) -> tuple[list[tuple[str, str]], list[str]]: ... +def gnu_getopt( + args: list[str], shortopts: str, longopts: Iterable[str] | str = [] +) -> tuple[list[tuple[str, str]], list[str]]: ... class GetoptError(Exception): msg: str