LSSTApplications  17.0+10,17.0+51,17.0+88,18.0.0+10,18.0.0+15,18.0.0+34,18.0.0+4,18.0.0+6,18.0.0-2-ge43143a+6,18.1.0-1-g0001055+2,18.1.0-1-g0896a44+10,18.1.0-1-g1349e88+9,18.1.0-1-g2505f39+7,18.1.0-1-g380d4d4+9,18.1.0-1-g5e4b7ea+2,18.1.0-1-g7e8fceb,18.1.0-1-g85f8cd4+7,18.1.0-1-g9a6769a+3,18.1.0-1-ga1a4c1a+6,18.1.0-1-gc037db8+2,18.1.0-1-gd55f500+3,18.1.0-1-ge10677a+7,18.1.0-10-g73b8679e+12,18.1.0-12-gf30922b,18.1.0-13-g451e75588,18.1.0-13-gbfe7f7f,18.1.0-2-g31c43f9+7,18.1.0-2-g9c63283+9,18.1.0-2-gdf0b915+9,18.1.0-2-gf03bb23+2,18.1.0-3-g52aa583+3,18.1.0-3-g8f4a2b1+1,18.1.0-3-g9cb968e+8,18.1.0-4-g7bbbad0,18.1.0-5-g510c42a+8,18.1.0-5-ga46117f,18.1.0-5-gaeab27e+9,18.1.0-6-gdda7f3e+11,18.1.0-8-g4084bf03+1,w.2019.34
LSSTDataManagementBasePackage
Functions
lsst.pex.config.convert Namespace Reference

Functions

def makePropertySet (config)
 
def makePolicy (config)
 

Function Documentation

◆ makePolicy()

def lsst.pex.config.convert.makePolicy (   config)
Convert a configuration into a `lsst.pex.policy.Policy`.

Parameters
----------
config : `lsst.pex.config.Config`
    Configuration instance.

Returns
-------
policy : `lsst.pex.policy.Policy`
    A `~lsst.pex.policy.Policy` that is equivalent to the ``config``
    instance. If ``config`` is `None` then return value is also `None`.

See also
--------
makePropertySet
lsst.pex.policy.Policy

Definition at line 65 of file convert.py.

65 def makePolicy(config):
66  """Convert a configuration into a `lsst.pex.policy.Policy`.
67 
68  Parameters
69  ----------
70  config : `lsst.pex.config.Config`
71  Configuration instance.
72 
73  Returns
74  -------
75  policy : `lsst.pex.policy.Policy`
76  A `~lsst.pex.policy.Policy` that is equivalent to the ``config``
77  instance. If ``config`` is `None` then return value is also `None`.
78 
79  See also
80  --------
81  makePropertySet
82  lsst.pex.policy.Policy
83  """
84  def _helper(dict_):
86  for k, v in dict_.items():
87  if isinstance(v, dict):
88  p.set(k, _helper(v))
89  elif isinstance(v, list):
90  for vi in v:
91  p.add(k, vi)
92  elif v is not None:
93  p.set(k, v)
94  return p
95  if config:
96  return _helper(config.toDict())
97  else:
98  return None
99 
a container for holding hierarchical configuration data in memory.
Definition: Policy.h:167
PersistenceHelper _helper
Definition: Exposure.cc:219
def makePolicy(config)
Definition: convert.py:65

◆ makePropertySet()

def lsst.pex.config.convert.makePropertySet (   config)
Convert a configuration into a `lsst.daf.base.PropertySet`.

Parameters
----------
config : `lsst.pex.config.Config`
    Configuration instance.

Returns
-------
propertySet : `lsst.daf.base.PropertySet`
    A `~lsst.daf.base.PropertySet` that is equivalent to the ``config``
    instance. If ``config`` is `None` then this return value is also
    `None`.

See also
--------
makePolicy
lsst.daf.base.PropertySet

Definition at line 29 of file convert.py.

29 def makePropertySet(config):
30  """Convert a configuration into a `lsst.daf.base.PropertySet`.
31 
32  Parameters
33  ----------
34  config : `lsst.pex.config.Config`
35  Configuration instance.
36 
37  Returns
38  -------
39  propertySet : `lsst.daf.base.PropertySet`
40  A `~lsst.daf.base.PropertySet` that is equivalent to the ``config``
41  instance. If ``config`` is `None` then this return value is also
42  `None`.
43 
44  See also
45  --------
46  makePolicy
47  lsst.daf.base.PropertySet
48  """
49  def _helper(ps, prefix, dict_):
50  for k, v in dict_.items():
51  name = prefix + "." + k if prefix is not None else k
52  if isinstance(v, dict):
53  _helper(ps, name, v)
54  elif v is not None:
55  ps.set(name, v)
56 
57  if config is not None:
59  _helper(ps, None, config.toDict())
60  return ps
61  else:
62  return None
63 
64 
def makePropertySet(config)
Definition: convert.py:29
PersistenceHelper _helper
Definition: Exposure.cc:219
Class for storing generic metadata.
Definition: PropertySet.h:67