InputOnlyArgumentParser¶
-
class
lsst.pipe.base.InputOnlyArgumentParser(name, usage='%(prog)s input [options]', **kwargs)[source]¶ Bases:
lsst.pipe.base.ArgumentParserArgumentParserfor command-line tasks that don’t write any output.Attributes Summary
requireOutputMethods Summary
add_argument(dest, ...[, name, name])add_argument_group(*args, **kwargs)add_id_argument(name, datasetType, help[, ...])Add a data ID argument. add_mutually_exclusive_group(**kwargs)add_subparsers(**kwargs)convert_arg_line_to_args(arg_line)Allow files of arguments referenced by @<path>to contain multiple values on each line.error(message: string)Prints a usage message incorporating the message to stderr and exits. exit([status, message])format_help()format_usage()get_default(dest)handleCamera(namespace)Perform camera-specific operations before parsing the command-line. parse_args(config[, args, log, override])Parse arguments for a command-line task. parse_known_args([args, namespace])print_help([file])print_usage([file])register(registry_name, value, object)set_defaults(**kwargs)Attributes Documentation
-
requireOutput= False¶
Methods Documentation
-
add_argument(dest, ..., name=value, ...) add_argument(option_string, option_string, ..., name=value, ...)¶
-
add_argument_group(*args, **kwargs)¶
-
add_id_argument(name, datasetType, help, level=None, doMakeDataRefList=True, ContainerClass=<class 'lsst.pipe.base.argumentParser.DataIdContainer'>)¶ Add a data ID argument.
Parameters: name :
strData ID argument (including leading dashes, if wanted).
datasetType :
strorDynamicDatasetType-typeType of dataset. Supply a string for a fixed dataset type. For a dynamically determined dataset type, supply a
DynamicDatasetType, such aDatasetArgument.help :
strHelp string for the argument.
level : object, optional
Level of dataset, for the
Butler.doMakeDataRefList : bool, optional
If
True(default), construct data references.ContainerClass : class, optional
Data ID container class to use to contain results; override the default if you need a special means of computing data references from data IDs
Notes
If
datasetTypeis an instance ofDatasetArgument, then add a second argument to specify the dataset type.The associated data is put into
namespace.<dataIdArgument.name>as an instance of ContainerClass; the container includes fields:idList: a list of data ID dicts.refList: a list ofButlerdata references (empty ifdoMakeDataRefListisFalse).
-
add_mutually_exclusive_group(**kwargs)¶
-
add_subparsers(**kwargs)¶
-
convert_arg_line_to_args(arg_line)¶ Allow files of arguments referenced by
@<path>to contain multiple values on each line.Parameters: arg_line :
strLine of text read from an argument file.
-
error(message: string)¶ Prints a usage message incorporating the message to stderr and exits.
If you override this in a subclass, it should not return – it should either exit or raise an exception.
-
exit(status=0, message=None)¶
-
format_help()¶
-
format_usage()¶
-
get_default(dest)¶
-
handleCamera(namespace)¶ Perform camera-specific operations before parsing the command-line.
Parameters: namespace :
argparse.NamespaceNamespace (an ) with the following fields:
camera: the camera name.config: the config passed to parse_args, with no overrides applied.obsPkg: theobs_package for this camera.log: alsst.logLog.
Notes
The default implementation does nothing.
-
parse_args(config, args=None, log=None, override=None)¶ Parse arguments for a command-line task.
Parameters: config :
lsst.pex.config.ConfigConfig for the task being run.
args :
list, optionalArgument list; if
Nonethensys.argv[1:]is used.log :
lsst.log.Log, optionalLoginstance; ifNoneuse the default log.override : callable, optional
A config override function. It must take the root config object as its only argument and must modify the config in place. This function is called after camera-specific overrides files are applied, and before command-line config overrides are applied (thus allowing the user the final word).
Returns: namespace :
argparse.NamespaceA
Namespaceinstance containing fields:camera: camera name.config: the supplied config with all overrides applied, validated and frozen.butler: alsst.daf.persistence.Butlerfor the data.- An entry for each of the data ID arguments registered by
add_id_argument, the value of which is aDataIdArgumentthat includes public elementsidListandrefList. log: alsst.logLog.- An entry for each command-line argument, with the following exceptions: - config is the supplied config, suitably updated. - configfile, id and loglevel are all missing.
obsPkg: name of theobs_package for this camera.
-
parse_known_args(args=None, namespace=None)¶
-
print_help(file=None)¶
-
print_usage(file=None)¶
-
register(registry_name, value, object)¶
-
set_defaults(**kwargs)¶
-