sisl.utils.cmd module¶
Generic utility to create commonly used ArgumentParser options etc.
-
sisl.utils.cmd.
argv_negative_fix
(argv)[source]¶ Fixes the
argv
list by adding a space for input that may be float’s
-
sisl.utils.cmd.
collect_arguments
(argv, input=False, argumentparser=None, namespace=None)[source]¶ Function for returning the actual arguments depending on the input options.
This function will create a fake
ArgumentParser
which then will pass through the input figuring out which options that should be given to the finalArgumentParser
.Parameters: argv :
list
ofstr
the argument list that comprise the arguments
input :
bool
,False
whether or not the arguments should also gather from the input file.
argumentparser :
argparse.ArgumentParser
the argument parser that should add the options that we find from the output and input files.
namespace :
Namespace
the namespace for the argument parser.
-
sisl.utils.cmd.
collect_input
(argv)[source]¶ Function for returning the input file
This simply creates a shortcut input file and returns it.
-
sisl.utils.cmd.
dec_collect_action
(func)[source]¶ Decorator for collecting actions until the namespace
_actions_run
isTrue
.Note that the
Namespace
object is the 2nd argument.
-
sisl.utils.cmd.
dec_collect_and_run_action
(func)[source]¶ Decorator for collecting actions and running.
Note that the
Namespace
object is the 2nd argument.
-
sisl.utils.cmd.
dec_default_AP
(*A_args, **A_kwargs)[source]¶ Decorator for routines which takes a parser as argument and ensures that it is _not_
None
.
-
sisl.utils.cmd.
dec_run_actions
(func)[source]¶ Decorator for running collected actions.
Note that the
Namespace
object is the 2nd argument.
-
sisl.utils.cmd.
ensure_namespace
(p, ns)[source]¶ Ensure a namespace passed in case it is not.
- This is currently a hack for:
- https://bugs.python.org/issue27859