lsst.obs.base  21.0.0-23-ga70773b+94cdb500b3
Public Member Functions | List of all members
lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree Class Reference
Inheritance diagram for lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree:
lsst.obs.base.gen2to3.repoWalker.builders.BuilderNode

Public Member Functions

def __init__ (self)
 
def insert (self, int level, BuilderInput leaf)
 
def fill (self, DirectoryScanner scanner, Dict[str, type] allKeys, Dict[str, type] previousKeys, *Optional[re.Pattern] fileIgnoreRegEx, Optional[re.Pattern] dirIgnoreRegEx)
 
Tuple[BuilderNode, List[str], bool] prune (self)
 
PathElementHandler build (self, PathElementParser parser, Dict[str, type] allKeys, Dict[str, type] cumulativeKeys, *Optional[re.Pattern] fileIgnoreRegEx, Optional[re.Pattern] dirIgnoreRegEx)
 

Detailed Description

A `BuilderNode` that represents a directory.

This is the only `BuilderNode` class that is not a leaf node.  If all
of its children can be pruned, it is replaced by a `BuilderPrunedTree`
(which can then be pruned itself).  It builds `SubdirectoryHandler`
instances when not pruned.

Definition at line 323 of file builders.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree.__init__ (   self)

Definition at line 331 of file builders.py.

Member Function Documentation

◆ build()

PathElementHandler lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree.build (   self,
PathElementParser  parser,
Dict[str, type]  allKeys,
Dict[str, type]  cumulativeKeys,
*Optional[re.Pattern]  fileIgnoreRegEx,
Optional[re.Pattern]   dirIgnoreRegEx 
)
Transform this node in the build tree into a corresponding
`PathElementHandler`, recursing to any children.

Must be called after `prune`.

Parameters
----------
parser : `PathElementParser`
    An object that matches the path element the new handler is
    responsible for and extracts a (partial) Gen2 data ID from it.
allKeys : `dict` [`str`, `type`]
    A mapping from Gen2 data ID key to the type of its value.  Will
    contain all keys that may be extracted by the given parser, and
    possibly others.
cumulativeKeys : `dict` [`str`, `type`], optional
    A dictionary containing key strings and types for Gen2 data ID keys
    that have been extracted from previous path elements for this
    template, including those extracted by ``parser``.

Returns
-------
handler : `PathElementHandler`
    A new handler object.

Reimplemented from lsst.obs.base.gen2to3.repoWalker.builders.BuilderNode.

Definition at line 413 of file builders.py.

◆ fill()

def lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree.fill (   self,
DirectoryScanner  scanner,
Dict[str, type]  allKeys,
Dict[str, type]  previousKeys,
*Optional[re.Pattern]  fileIgnoreRegEx,
Optional[re.Pattern]  dirIgnoreRegEx 
)
Fill a `DirectoryScanner` instance by recursively building all
child nodes.

Parameters
----------
scanner : `DirectoryScanner`
    Object to populate.
allKeys : `dict` [`str`, `type`]
    Mapping from Gen2 data ID key to its value type, covering all keys
    that could be used in any child template.
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.
fileIgnoreRegEx : `re.Pattern`, optional
    A regular expression pattern that identifies non-dataset files that
    can be ignored, to be applied at all levels of the directory tree.
dirIgnoreRegEx : `re.Pattern`, optional
    A regular expression pattern that identifies non-dataset
    subdirectories that can be ignored, to be applied at all levels of
    the directory tree.

Definition at line 360 of file builders.py.

◆ insert()

def lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree.insert (   self,
int  level,
BuilderInput  leaf 
)
Insert an input leaf node into the tree, recursively constructing
intermediate parents in order to put it at the right level.

Parameters
----------
level : `int`
    The level ``self``is at in the larger tree, with zero the
    repository root.  The right level for the leaf is given by the
    length of ``leaf.elements``.
leaf : `BuilderInput`
    The leaf node to insert.

Definition at line 334 of file builders.py.

◆ prune()

Tuple[BuilderNode, List[str], bool] lsst.obs.base.gen2to3.repoWalker.builders.BuilderTree.prune (   self)
Attempt to prune this node and its children from the tree.

Returns
-------
replacement : `BuilderNode`
    The result of recursively pruning child nodes; often just ``self``.
messages : `list` [`str`]
    Warning messages that should be logged by a parent node when a
    matching path element is encountered, if this node is pruned.
prune : `bool`
    If `True`, this node may be pruned from the tree (but will not
    necessarily be - it may correspond to a path element that should
    be skipped with siblings that should not be).

Reimplemented from lsst.obs.base.gen2to3.repoWalker.builders.BuilderNode.

Definition at line 395 of file builders.py.


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