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]#

Adds default arguments to all commands.

add_arguments()[source]#

Adds arguments specific to this command.

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

Adds an argument to the subparser.

abstract handle()[source]#

Runs the command.

prefix()[source]#

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

items(**kwargs)[source]#

Yields the items in the input.

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

Prints 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]#

Adds default arguments to all commands.

prefix()[source]#

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

items(**kwargs)[source]#

Yields the items in the input. If an item is an array, yields each entry of the array.

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

Adds arguments for setting package metadata to the subparser.

parse_package_arguments()[source]#

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