lsst.pipe.base  13.0-12-gaf0c0ec+8
Public Member Functions | List of all members
lsst.pipe.base.argumentParser.IdValueAction Class Reference

argparse action callback to process a data ID into a dict More...

Inheritance diagram for lsst.pipe.base.argumentParser.IdValueAction:

Public Member Functions

def __call__ (self, parser, namespace, values, option_string)
 Parse –id data and append results to namespace. More...
 

Detailed Description

argparse action callback to process a data ID into a dict

Definition at line 887 of file argumentParser.py.

Member Function Documentation

◆ __call__()

def lsst.pipe.base.argumentParser.IdValueAction.__call__ (   self,
  parser,
  namespace,
  values,
  option_string 
)

Parse –id data and append results to namespace.

<argument>.idList

Parameters
[in]parserargument parser (instance of ArgumentParser)
[in,out]namespaceparsed command (an instance of argparse.Namespace); updated values:
  • <idName>.idList, where <idName> is the name of the ID argument, for instance "id" for ID argument –id
[in]valuesa list of data IDs; see data format below
[in]option_stringoption value specified by the user (a str)

The data format is: key1=value1_1[^value1_2[^value1_3...] key2=value2_1[^value2_2[^value2_3...]...

The values (e.g. value1_1) may either be a string, or of the form "int..int" (e.g. "1..3") which is interpreted as "1^2^3" (inclusive, unlike a python range). So "0^2..4^7..9" is equivalent to "0^2^3^4^7^8^9". You may also specify a stride: "1..5:2" is "1^3^5"

The cross product is computed for keys with multiple values. For example: –id visit 1^2 ccd 1,1^2,2 results in the following data ID dicts being appended to namespace.<argument>.idList: {"visit":1, "ccd":"1,1"} {"visit":2, "ccd":"1,1"} {"visit":1, "ccd":"2,2"} {"visit":2, "ccd":"2,2"}

Definition at line 891 of file argumentParser.py.


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