mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
fix: ArgParse's registry for the type keyword argument to add_argument (#12194)
This commit is contained in:
@@ -32,6 +32,7 @@ _T = TypeVar("_T")
|
||||
_ActionT = TypeVar("_ActionT", bound=Action)
|
||||
_ArgumentParserT = TypeVar("_ArgumentParserT", bound=ArgumentParser)
|
||||
_N = TypeVar("_N")
|
||||
_ActionType: TypeAlias = Callable[[str], Any] | FileType | str
|
||||
# more precisely, Literal["store", "store_const", "store_true",
|
||||
# "store_false", "append", "append_const", "count", "help", "version",
|
||||
# "extend"], but using this would make it hard to annotate callers
|
||||
@@ -89,7 +90,7 @@ class _ActionsContainer:
|
||||
nargs: int | _NArgsStr | _SUPPRESS_T | None = None,
|
||||
const: Any = ...,
|
||||
default: Any = ...,
|
||||
type: Callable[[str], _T] | FileType = ...,
|
||||
type: _ActionType = ...,
|
||||
choices: Iterable[_T] | None = ...,
|
||||
required: bool = ...,
|
||||
help: str | None = ...,
|
||||
@@ -313,7 +314,7 @@ class Action(_AttributeHolder):
|
||||
nargs: int | str | None
|
||||
const: Any
|
||||
default: Any
|
||||
type: Callable[[str], Any] | FileType | None
|
||||
type: _ActionType | None
|
||||
choices: Iterable[Any] | None
|
||||
required: bool
|
||||
help: str | None
|
||||
|
||||
Reference in New Issue
Block a user