Mark optparse constants as final (#13451)

This commit is contained in:
Ali Hamdan
2025-02-03 09:05:41 +01:00
committed by GitHub
parent 30a4d10b71
commit a0db1ba8dc

View File

@@ -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: ...