lsst.obs.base  19.0.0-51-gb87bce2+1
Public Member Functions | Public Attributes | List of all members
lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser Class Reference

Public Member Functions

def __init__ (self, str template, Dict[str, type] allKeys, *Optional[Dict[str, type]] previousKeys=None)
 
def __str__ (self)
 
Optional[dict] parse (self, str name, dict lastDataId, *Optional[Log] log=None)
 

Public Attributes

 template
 
 keys
 
 regex
 

Detailed Description

An object that matches Gen2 file names and extracts Gen2 data IDs.

Parameters
----------
target : `str`
    Either a full Gen2 path template or the part of one the corresponds to
    a single path element (a subdirectory or file name).
allKeys : `dict` [`str`, `type`]
    A dictionary that provides types for all Gen2 data ID keys that are
    substituted into the given template.  Additional key-value pairs may
    be present and will be ignored.
previousKeys : `dict` [`str`, `type`], optional
    A dictionary containing key strings and types for Gen2 data ID keys
    that have been extracted from previous path elements of the same
    template.  Values for these keys must be provided via the
    ``lastDataId`` argument when calling `parse`.

Definition at line 116 of file parser.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser.__init__ (   self,
str  template,
Dict[str, type]  allKeys,
*Optional[Dict[str, type]]   previousKeys = None 
)

Definition at line 134 of file parser.py.

Member Function Documentation

◆ __str__()

def lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser.__str__ (   self)

Definition at line 189 of file parser.py.

◆ parse()

Optional[dict] lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser.parse (   self,
str  name,
dict  lastDataId,
*Optional[Log]   log = None 
)
Parse the path element.

Parameters
----------
name : `str`
    The path name to parse.
lastDataId : `dict`
    The cumulative Gen2 data ID obtaining by calling `parse` on parsers
    for parent directories of the same path.
log : `Log`, optional
    Log to use to report warnings and debug information.

Returns
-------
dataId : `dict` or `None`
    Gen2 data ID that combines key-value pairs obtained from this path
    with those from ``lastDataId``.  `None` if ``name`` is not matched
    by this parser.  If the keys extracted are inconsistent with those
    in ``lastDataID``, a warning is sent to ``log`` and `None` is
    returned.

Definition at line 192 of file parser.py.

Member Data Documentation

◆ keys

lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser.keys

Definition at line 136 of file parser.py.

◆ regex

lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser.regex

Definition at line 140 of file parser.py.

◆ template

lsst.obs.base.gen2to3.repoWalker.parser.PathElementParser.template

Definition at line 135 of file parser.py.


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