tracktable.script_helpers package¶
Submodules¶
- tracktable.script_helpers.argument_groups package
- tracktable.script_helpers.argument_groups.dt_point_loader module
- tracktable.script_helpers.argument_groups.mapmaker module
- tracktable.script_helpers.argument_groups.movie_rendering module
- tracktable.script_helpers.argument_groups.parallel module
- tracktable.script_helpers.argument_groups.trajectory_assembly module
- tracktable.script_helpers.argument_groups.trajectory_rendering module
- tracktable.script_helpers.argument_groups.utilities module
- Module contents
Module contents¶
Tracktable Trajectory Toolkit - Helper functions for creating scripts
-
tracktable.script_helpers.
n_at_a_time
(iterable, howmany, fillvalue=None)[source]¶ Collect data into fixed-length chunks or blocks
This function is an adapter for an iterable that returns objects N at a time instead of one at a time.
Example
>>> list(n_at_a_time(range(10), 3, -1)) [(0, 1, 2), (3, 4, 5), (6, 7, 8), (9, -1, -1)]
- Args:
iterable {sequence}: Data source howmany {int}: How many elements to take at a time fillvalue {any}: Value to pad with if the iterable runs out
- Returns:
New sequence whose elements are tuples of elements from the original iterable
Customized version of argparse with Response Files
Regular argparse has some support for response files but they’re pretty bare. There’s nowhere to put comments, for example. This subclass enhances that. It adds a few capabilities:
Argument Groups - Use a group of thematically-related arguments all at once instead of having to insert them one by one
Response Files - Response files can have comments in them. They will be automatically parsed from the command line.
–write-response-file - Like –help, this will write an example response file and then exit.
-
class
tracktable.script_helpers.argparse.
ArgumentParser
(add_response_file=True, fromfile_prefix_chars='@', prefix_chars='-', comment_character='#', conflict_handler='resolve', **kwargs)[source]¶ Enhanced version of the standard Python ArgumentParser.
-
add_response_file
¶ Add the ‘–write-response-file’ option.
- Type
boolean
-
comment_character
¶ This character indicates that a line in a response file should be ignored.
- Type
string
ORIGINAL ARGPARSE DOCUMENTATION:
Object for parsing command line strings into Python objects.
- Keyword Arguments
prog -- The name of the program (default (-) – sys.argv[0])
usage -- A usage message (default (-) – auto-generated from arguments)
description -- A description of what the program does (-) –
epilog -- Text following the argument descriptions (-) –
parents -- Parsers whose arguments should be copied into this one (-) –
formatter_class -- HelpFormatter class for printing help messages (-) –
prefix_chars -- Characters that prefix optional arguments (-) –
fromfile_prefix_chars -- Characters that prefix files containing (-) – additional arguments
argument_default -- The default value for all arguments (-) –
conflict_handler -- String indicating how to handle conflicts (-) –
add_help -- Add a -h/-help option (-) –
-
write_response_file
(out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]¶ Write an example response file
Write a response file with every line commented out to the specified file-like object. It will be populated with every argument (positional and optional) that has been configured for this parser including descent into any argument groups. The ‘–help’ and ‘–write-response-file’ arguments will be omitted.
- Parameters
out – File-like object for output
- Returns
None
-