flitsr.args.Args

class flitsr.args.Args(*args, **kwargs)

Bases: Namespace

The global Singleton holding the specified/default arguments used across the flitsr framework.

__init__(argv: List[str] | None = None, cmd_line=False, noparse=False)

Initialize the Args Singleton object. Note that this constructor is only ever called once for each program run. Other attempts to construct this object will return the pre-existing Args Singleton object.

Parameters:
  • argv – Optional[List[str]]: The optional list of command line arguments to parse. If not given and the Args object is set to read from the command line (see cmd_line), sys.argv is used instead.

  • cmd_line – bool: Whether to parse arguments given in command-line style. When True, Args will either parse the arguments given in argv, or sys.argv if argv is None. If False, Args will just load the default values for each command line option, and ignore required arguments. (Default value = False)

  • noparse – bool: When True, this Args object will not attempt to parse any arguments. This is primarily used for generating documentation for flitsr’s command line. (Default value = False)

Methods

__init__([argv, cmd_line, noparse])

Initialize the Args Singleton object.

get_arg_group(group_name)

Return the arguments for the given argument group.

get_arg_group(group_name) Dict[str, Any]

Return the arguments for the given argument group.

Parameters:

group_name – The name of the argument group to get arguments for. For example, for the SBFL advanced type, the argument name would be “sbfl”, and would return any arguments that SBFL needs.

Returns:

A dictionary with all the arguments in this group as key-value pairs. This can be used when calling a function that requires these arguments using python dictionary unpacking (e.g. function_to_call(**get_arg_group(...))).