grepros 1.2.2
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
ArgumentUtil Class Reference

Namespace for program argument handling. More...

Classes

class  HelpFormatter
 RawTextHelpFormatter returning custom metavar for non-flattenable list arguments. More...
 

Public Member Functions

 flatten (cls, args)
 Returns new program argument namespace with list values flattened and deduplicated.
 
 make_parser (cls, arguments, formatter=HelpFormatter)
 Returns a configured ArgumentParser instance for program arguments.
 
 process_types (cls, args)
 Converts and validates types in argument namespace, returns list of errors, if any.
 
 transform (cls, args, cli=False)
 Sets command-line specific flag state to program argument namespace.
 
 validate (cls, args, cli=False)
 Converts and validates program argument namespace, prints and raises on error.
 
 verify (cls, args)
 Validates arguments, prints errors, returns success.
 

Static Public Attributes

dict DEDUPE_UNLESS = {"PATTERN": "EXPRESSION"}
 
dict NO_FLATTENS = {"WRITE"}
 
dict PRECASTS = {"NTH_INTERVAL": lambda v: import_item("grepros.api").to_sec(v)}
 
dict SIGNED_INTS = {"START_INDEX", "END_INDEX", "START_LINE", "END_LINE"}
 
dict STRING_COLLECTIONS
 
dict STRINGS = {"PUBLISH_PREFIX", "PUBLISH_SUFFIX", "PUBLISH_FIXNAME"}
 
dict UNSIGNED_FLOATS = {"NTH_INTERVAL", "TIME_SCALE"}
 
dict UNSIGNED_INTS
 
dict UNSIGNED_WHEN = {"START_INDEX": "LIVE", "END_INDEX": "LIVE"}
 

Detailed Description

Namespace for program argument handling.

Definition at line 289 of file common.py.

Member Function Documentation

◆ flatten()

flatten (   cls,
  args 
)

Returns new program argument namespace with list values flattened and deduplicated.

Definition at line 357 of file common.py.

◆ make_parser()

make_parser (   cls,
  arguments,
  formatter = HelpFormatter 
)

Returns a configured ArgumentParser instance for program arguments.

Parameters
argumentsargparse options as {description, epilog, arguments: [], groups: []}
formatterhelp formatter class to use

Definition at line 328 of file common.py.

◆ process_types()

process_types (   cls,
  args 
)

Converts and validates types in argument namespace, returns list of errors, if any.

Definition at line 433 of file common.py.

◆ transform()

transform (   cls,
  args,
  cli = False 
)

Sets command-line specific flag state to program argument namespace.

Definition at line 372 of file common.py.

◆ validate()

validate (   cls,
  args,
  cli = False 
)

Converts and validates program argument namespace, prints and raises on error.

Returns new namespace with arguments in expected type and form.

Definition at line 348 of file common.py.

◆ verify()

verify (   cls,
  args 
)

Validates arguments, prints errors, returns success.

Parameters
argsarguments object like argparse.Namespace

Definition at line 404 of file common.py.

Member Data Documentation

◆ DEDUPE_UNLESS

dict DEDUPE_UNLESS = {"PATTERN": "EXPRESSION"}
static

Definition at line 304 of file common.py.

◆ NO_FLATTENS

dict NO_FLATTENS = {"WRITE"}
static

Definition at line 300 of file common.py.

◆ PRECASTS

dict PRECASTS = {"NTH_INTERVAL": lambda v: import_item("grepros.api").to_sec(v)}
static

Definition at line 303 of file common.py.

◆ SIGNED_INTS

dict SIGNED_INTS = {"START_INDEX", "END_INDEX", "START_LINE", "END_LINE"}
static

Definition at line 296 of file common.py.

◆ STRING_COLLECTIONS

dict STRING_COLLECTIONS
static
Initial value:
= {"TOPIC", "SKIP_TOPIC", "TYPE", "SKIP_TYPE", "SELECT_FIELD",
"NO_SELECT_FIELD", "EMIT_FIELD", "NO_EMIT_FIELD", "MATCH_WRAPPER"}

Definition at line 298 of file common.py.

◆ STRINGS

dict STRINGS = {"PUBLISH_PREFIX", "PUBLISH_SUFFIX", "PUBLISH_FIXNAME"}
static

Definition at line 297 of file common.py.

◆ UNSIGNED_FLOATS

dict UNSIGNED_FLOATS = {"NTH_INTERVAL", "TIME_SCALE"}
static

Definition at line 295 of file common.py.

◆ UNSIGNED_INTS

dict UNSIGNED_INTS
static
Initial value:
= {"NTH_MESSAGE", "NTH_MATCH", "MAX_COUNT", "MAX_PER_TOPIC", "MAX_TOPICS",
"BEFORE", "AFTER", "CONTEXT", "LINES_AROUND_MATCH", "MAX_FIELD_LINES",
"MAX_MESSAGE_LINES", "WRAP_WIDTH", "QUEUE_SIZE_IN", "QUEUE_SIZE_OUT"}

Definition at line 292 of file common.py.

◆ UNSIGNED_WHEN

dict UNSIGNED_WHEN = {"START_INDEX": "LIVE", "END_INDEX": "LIVE"}
static

Definition at line 302 of file common.py.


The documentation for this class was generated from the following file: