typeshed
typeshed copied to clipboard
ArgParse types don't allow using ArgParse's registry for the `type` keyword argument to `add_argument`
ArgParse supports a registry feature, where you can name a function, and then pass that name instead of the actual function for the type of an argument added with add_argument.
But the types in typeshed say that strings are not allowed to be passed: https://github.com/python/typeshed/blob/4aae235cefd62ec417b92166d2bcf038cb8801e8/stdlib/argparse.pyi#L92C12-L92C12
This leads to type-checking errors when you try to use the registry for type.
That applies to Action.type as well. A type alias _ActionType might be a good idea here. Any PRs welcome!