LSST Applications  22.0.1,22.0.1+01bcf6a671,22.0.1+046ee49490,22.0.1+05c7de27da,22.0.1+0c6914dbf6,22.0.1+1220d50b50,22.0.1+12fd109e95,22.0.1+1a1dd69893,22.0.1+1c910dc348,22.0.1+1ef34551f5,22.0.1+30170c3d08,22.0.1+39153823fd,22.0.1+611137eacc,22.0.1+771eb1e3e8,22.0.1+94e66cc9ed,22.0.1+9a075d06e2,22.0.1+a5ff6e246e,22.0.1+a7db719c1a,22.0.1+ba0d97e778,22.0.1+bfe1ee9056,22.0.1+c4e1e0358a,22.0.1+cc34b8281e,22.0.1+d640e2c0fa,22.0.1+d72a2e677a,22.0.1+d9a6b571bd,22.0.1+e485e9761b,22.0.1+ebe8d3385e
LSST Data Management Base Package
Public Member Functions | List of all members
lsst.pipe.base.config.PipelineTaskConfigMeta Class Reference
Inheritance diagram for lsst.pipe.base.config.PipelineTaskConfigMeta:
lsst.pipe.base.config.PipelineTaskConfig lsst.pipe.tasks.deblendCoaddSourcesPipeline.DeblendCoaddSourcesMultiConfig lsst.pipe.tasks.deblendCoaddSourcesPipeline.DeblendCoaddSourcesSingleConfig

Public Member Functions

def __new__ (cls, name, bases, dct, **kwargs)
 
def __init__ (self, name, bases, dct, **kwargs)
 

Detailed Description

Metaclass used in the creation of PipelineTaskConfig classes

This metaclass ensures a `PipelineTaskConnections` class is specified in
the class construction parameters with a parameter name of
pipelineConnections. Using the supplied connection class, this metaclass
constructs a `lsst.pex.config.Config` instance which can be used to
configure the connections class. This config is added to the config class
under declaration with the name "connections" used as an identifier. The
connections config also has a reference to the connections class used in
its construction associated with an atttribute named `ConnectionsClass`.
Finally the newly constructed config class (not an instance of it) is
assigned to the Config class under construction with the attribute name
`ConnectionsConfigClass`.

Definition at line 74 of file config.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.base.config.PipelineTaskConfigMeta.__init__ (   self,
  name,
  bases,
  dct,
**  kwargs 
)

Definition at line 135 of file config.py.

135  def __init__(self, name, bases, dct, **kwargs):
136  # This overrides the default init to drop the kwargs argument. Python
137  # metaclasses will have this argument set if any kwargs are passes at
138  # class construction time, but should be consumed before calling
139  # __init__ on the type metaclass. This is in accordance with python
140  # documentation on metaclasses
141  super().__init__(name, bases, dct)
142 
143 

Member Function Documentation

◆ __new__()

def lsst.pipe.base.config.PipelineTaskConfigMeta.__new__ (   cls,
  name,
  bases,
  dct,
**  kwargs 
)

Definition at line 89 of file config.py.

89  def __new__(cls, name, bases, dct, **kwargs):
90  if name != "PipelineTaskConfig":
91  # Verify that a connection class was specified and the argument is
92  # an instance of PipelineTaskConfig
93  if 'pipelineConnections' not in kwargs:
94  for base in bases:
95  if hasattr(base, "connections"):
96  kwargs['pipelineConnections'] = base.connections.dtype.ConnectionsClass
97  break
98  if 'pipelineConnections' not in kwargs:
99  raise NameError("PipelineTaskConfig or a base class must be defined with connections class")
100  connectionsClass = kwargs['pipelineConnections']
101  if not issubclass(connectionsClass, PipelineTaskConnections):
102  raise ValueError("Can only assign a PipelineTaskConnections Class to pipelineConnections")
103 
104  # Create all the fields that will be used in the newly created sub
105  # config (under the attribute name "connections")
106  configConnectionsNamespace = {}
107  for fieldName, obj in connectionsClass.allConnections.items():
108  configConnectionsNamespace[fieldName] = pexConfig.Field(dtype=str,
109  doc=f"name for "
110  f"connection {fieldName}",
111  default=obj.name)
112  # If there are default templates also add them as fields to
113  # configure the template values
114  if hasattr(connectionsClass, 'defaultTemplates'):
115  docString = "Template parameter used to format corresponding field template parameter"
116  for templateName, default in connectionsClass.defaultTemplates.items():
117  configConnectionsNamespace[templateName] = TemplateField(dtype=str,
118  doc=docString,
119  default=default)
120  # add a reference to the connection class used to create this sub
121  # config
122  configConnectionsNamespace['ConnectionsClass'] = connectionsClass
123 
124  # Create a new config class with the fields defined above
125  Connections = type("Connections", (pexConfig.Config,), configConnectionsNamespace)
126  # add it to the Config class that is currently being declared
127  dct['connections'] = pexConfig.ConfigField(dtype=Connections,
128  doc='Configurations describing the'
129  ' connections of the PipelineTask to datatypes')
130  dct['ConnectionsConfigClass'] = Connections
131  dct['ConnectionsClass'] = connectionsClass
132  inst = super().__new__(cls, name, bases, dct)
133  return inst
134 
table::Key< int > type
Definition: Detector.cc:163

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