Command-line utilities

class ocdskit.commands.base.StandardInputReader(encoding)[source]
read(buf_size)[source]
class ocdskit.commands.base.BaseCommand(subparsers)[source]
kwargs = {}
add_base_arguments()[source]

Add default arguments to all commands.

add_arguments()[source]

Add arguments specific to this command.

add_argument(*args, **kwargs)[source]

Add an argument to the subparser.

abstractmethod handle()[source]

Run the command.

prefix()[source]

Return the path to the items to process within each input.

items(**kwargs)[source]

Yield the items in the input.

print(data, *, streaming=False)[source]

Print JSON data.

Parameters:

streaming (bool) – whether to stream output using json.JSONEncoder().iterencode() (it is only more memory efficient if data contains iterators)

class ocdskit.commands.base.OCDSCommand(subparsers)[source]
add_base_arguments()[source]

Add default arguments to all commands.

prefix()[source]

Return the path to the items to process within each input.

items(**kwargs)[source]

Yield the items in the input. If an item is an array, yield each entry of the array.

add_package_arguments(infix, prefix='', version='1.1')[source]

Add arguments for setting package metadata to the subparser.

parse_package_arguments()[source]

Return package metadata as a dictionary to be used as keyword arguments.