From a0db1ba8dc26a6039257907b4782930275c55b8a Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Mon, 3 Feb 2025 09:05:41 +0100 Subject: [PATCH] Mark optparse constants as final (#13451) --- stdlib/optparse.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 583dd0da0..56a4574bd 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -2,7 +2,7 @@ import builtins from _typeshed import MaybeNone, SupportsWrite from abc import abstractmethod from collections.abc import Callable, Iterable, Mapping, Sequence -from typing import Any, ClassVar, Literal, NoReturn, overload +from typing import Any, ClassVar, Final, Literal, NoReturn, overload from typing_extensions import Self __all__ = [ @@ -24,10 +24,10 @@ __all__ = [ "BadOptionError", "check_choice", ] - -NO_DEFAULT: tuple[str, ...] -SUPPRESS_HELP: str -SUPPRESS_USAGE: str +# pytype is not happy with `NO_DEFAULT: Final = ("NO", "DEFAULT")` +NO_DEFAULT: Final[tuple[Literal["NO"], Literal["DEFAULT"]]] +SUPPRESS_HELP: Final = "SUPPRESSHELP" +SUPPRESS_USAGE: Final = "SUPPRESSUSAGE" # Can return complex, float, or int depending on the option's type def check_builtin(option: Option, opt: str, value: str) -> complex: ...