Belle II Software development
|
Public Member Functions | |
def | __init__ (self, args) |
def | add_arguments (self, name) |
def | __str__ (self) |
def | check_arguments (self) |
def | check (self, item) |
Protected Attributes | |
_args | |
arguments, either :class:argparse.ArgumentParser on initialization or :class:argparse.Namespace after argument parsing | |
_filter | |
regular expression for filtering items which don't match | |
_exclude | |
regular expression for excluding items which match | |
Class to filter a list of tags/payloads/iovs with a common interface, that is same set of parameters and easy handling of checking. This class defines -f,--filter/-e,--exclude/-r/--regex parameters which will be added to a :class:`argparse.ArgumentParser` when calling `add_arguments`.
Definition at line 19 of file cli_utils.py.
def __init__ | ( | self, | |
args | |||
) |
initialization, just remember the arguments or parser
Definition at line 28 of file cli_utils.py.
def __str__ | ( | self | ) |
Convert to a text representation of the form ' [regex filter=TERM exclude=TERM]'. The space in the beginning is intentional to allow easy adding to a description without extra spaces If no filtering is performed an empty string is returned. If the patterns are non-regex (without --regex), the regex will be missing in the string. If one of the --filter/--exclude option was not given, that part is removed from the string
Definition at line 54 of file cli_utils.py.
def add_arguments | ( | self, | |
name | |||
) |
Add arguments to the parser Parameters: name: Name of the objects to be filtered in the help text
Definition at line 38 of file cli_utils.py.
def check | ( | self, | |
item | |||
) |
Check an item. True is returned if it should be kept, False if it is filtered out or excluded. Parameters: item: item to be filtered
Definition at line 96 of file cli_utils.py.
def check_arguments | ( | self | ) |
Check if the arguments are valid (only if --regex is given) and compile into regular expressions. If False is returned there was an error with the regular expressions.
Definition at line 78 of file cli_utils.py.
|
protected |
arguments, either :class:argparse.ArgumentParser
on initialization or :class:argparse.Namespace
after argument parsing
Definition at line 32 of file cli_utils.py.
|
protected |
regular expression for excluding items which match
Definition at line 36 of file cli_utils.py.
|
protected |
regular expression for filtering items which don't match
Definition at line 34 of file cli_utils.py.