I have a function from an internal library:
def some_external_function(arg1: str, arg2: bool) -> bool:
pass
How can I get the args that are required for this function as a type hint? I want to be able to do something like:
from external_lib import some_external_function
create_args_for_external_function_args = Type(... args of some_external_function)
def create_args_for_external_function(data: create_args_for_external_function_args):
...
I am trying to do the following, create a list of function arguments that I an loop through and add additional ArgumentParser
arguments to my CLI with add_argument
as I'm implementing an abstract tool.
Essentially this:
main_parser = argparse.ArgumentParser(
parents=[some_base_parser]
)
# in real code comes from a higher level
list_of_add_argument_args = [
(("--recovery-code",), {"type": str, "help": "A recovery code to mark as used"}),
] <<<< This list is what I need typed
for extra_arg, extra_kwargs in list_of_add_argument_args:
main_parser.add_argument(*extra_arg, **extra_kwargs) < Unpack args into function somehow