LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Classes | Functions | Variables
lsst.pex.config.config Namespace Reference

Classes

class  ConfigMeta
 
class  FieldValidationError
 
class  Field
 
class  RecordingImporter
 
class  Config
 

Functions

def _joinNamePath
 
def _autocast
 
def _typeStr
 
def unreduceConfig
 

Variables

tuple __all__ = ("Config", "Field", "FieldValidationError")
 

Function Documentation

def lsst.pex.config.config._autocast (   x,
  dtype 
)
private
If appropriate perform type casting of value x to type dtype,
otherwise return the original value x

Definition at line 49 of file config.py.

49 
50 def _autocast(x, dtype):
51  """
52  If appropriate perform type casting of value x to type dtype,
53  otherwise return the original value x
54  """
55  if dtype==float and type(x)==int:
56  return float(x)
57  if dtype==int and type(x)==long:
58  return int(x)
59  return x
def lsst.pex.config.config._joinNamePath (   prefix = None,
  name = None,
  index = None 
)
private
Utility function for generating nested configuration names

Definition at line 33 of file config.py.

33 
34 def _joinNamePath(prefix=None, name=None, index=None):
35  """
36  Utility function for generating nested configuration names
37  """
38  if not prefix and not name:
39  raise ValueError("Invalid name: cannot be None")
40  elif not name:
41  name = prefix
42  elif prefix and name:
43  name = prefix + "." + name
44 
45  if index is not None:
46  return "%s[%r]"%(name, index)
47  else:
48  return name
def lsst.pex.config.config._typeStr (   x)
private
Utility function to generate a fully qualified type name.

This is used primarily in writing config files to be 
executed later upon 'load'.

Definition at line 60 of file config.py.

60 
61 def _typeStr(x):
62  """
63  Utility function to generate a fully qualified type name.
64 
65  This is used primarily in writing config files to be
66  executed later upon 'load'.
67  """
68  if hasattr(x, '__module__') and hasattr(x, '__name__'):
69  xtype = x
70  else:
71  xtype = type(x)
72  if xtype.__module__ == '__builtin__':
73  return xtype.__name__
74  else:
75  return "%s.%s"%(xtype.__module__, xtype.__name__)
def lsst.pex.config.config.unreduceConfig (   cls,
  stream 
)

Definition at line 743 of file config.py.

744 def unreduceConfig(cls, stream):
745  config = cls()
746  config.loadFromStream(stream)
747  return config

Variable Documentation

tuple lsst.pex.config.config.__all__ = ("Config", "Field", "FieldValidationError")

Definition at line 31 of file config.py.