-
-
Save sigmavirus24/bbf342e524b4433e0aabae785f7ba9ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
B_DEFAULT = 'default_b' | |
def function_a(**kwargs): | |
arg_a = kwargs.pop('arg_a') | |
arg_b = kwargs.pop('arg_b', B_DEFAULT) | |
do_something(parsed_args.arg_a) | |
return something | |
def function_b(parsed_args): | |
function_a(arg_a=parsed_args.arg_a) | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--arg_a", default="default_a") | |
parser.add_argument("--arg_b", default=B_DEFAULT) | |
args = parser.parse_args() | |
function_b(args) | |
function_a(arg_a=args.arg_a, arg_b=args.arg_b) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment