LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
Public Member Functions | |
def | __init__ (self, other=None) |
def | ppprint (self) |
def | __repr__ (self) |
def | __getitem__ (self, name) |
def | __setitem__ (self, name, value) |
def | __contains__ (self, key) |
def | update (self, other) |
def | merge (self, other) |
def | names (self, topLevelOnly=False) |
def | asArray (self, name) |
def | getValue (self, name) |
def | setValue (self, name, value) |
def | mergeDefaults (self, other) |
def | exists (self, key) |
def | getString (self, key) |
def | getBool (self, key) |
def | getPolicy (self, key) |
def | getStringArray (self, key) |
def | __lt__ (self, other) |
def | __le__ (self, other) |
def | __eq__ (self, other) |
def | __ne__ (self, other) |
def | __gt__ (self, other) |
def | __ge__ (self, other) |
def | dump (self, output) |
i/o # More... | |
def | dumpToFile (self, path) |
Static Public Member Functions | |
def | defaultPolicyFile (productName, fileName, relativePath=None) |
Public Attributes | |
data | |
Policy implements a datatype that is used by Butler for configuration parameters. It is essentially a dict with key/value pairs, including nested dicts (as values). In fact, it can be initialized with a dict. The only caveat is that keys may NOT contain dots ('.'). This is explained next: Policy extends the dict api so that hierarchical values may be accessed with dot-delimited notiation. That is, foo.getValue('a.b.c') is the same as foo['a']['b']['c'] is the same as foo['a.b.c'], and either of these syntaxes may be used. Storage format supported: - yaml: read and write is supported.
def lsst.daf.persistence.policy.Policy.__init__ | ( | self, | |
other = None |
|||
) |
Initialize the Policy. Other can be used to initialize the Policy in a variety of ways: other (string) Treated as a path to a policy file on disk. Must end with '.yaml'. other (Policy) Copies the other Policy's values into this one. other (dict) Copies the values from the dict into this Policy.
Definition at line 60 of file policy.py.
def lsst.daf.persistence.policy.Policy.__contains__ | ( | self, | |
key | |||
) |
def lsst.daf.persistence.policy.Policy.__eq__ | ( | self, | |
other | |||
) |
def lsst.daf.persistence.policy.Policy.__ge__ | ( | self, | |
other | |||
) |
def lsst.daf.persistence.policy.Policy.__getitem__ | ( | self, | |
name | |||
) |
def lsst.daf.persistence.policy.Policy.__gt__ | ( | self, | |
other | |||
) |
def lsst.daf.persistence.policy.Policy.__le__ | ( | self, | |
other | |||
) |
def lsst.daf.persistence.policy.Policy.__lt__ | ( | self, | |
other | |||
) |
def lsst.daf.persistence.policy.Policy.__ne__ | ( | self, | |
other | |||
) |
def lsst.daf.persistence.policy.Policy.__repr__ | ( | self | ) |
def lsst.daf.persistence.policy.Policy.__setitem__ | ( | self, | |
name, | |||
value | |||
) |
def lsst.daf.persistence.policy.Policy.asArray | ( | self, | |
name | |||
) |
Get a value as an array. May contain one or more elements. :param key: :return:
|
static |
Get the path to a default policy file. Determines a directory for the product specified by productName. Then Concatenates productDir/relativePath/fileName (or productDir/fileName if relativePath is None) to find the path to the default Policy file @param productName (string) The name of the product that the default policy is installed as part of @param fileName (string) The name of the policy file. Can also include a path to the file relative to the directory where the product is installed. @param relativePath (string) The relative path from the directior where the product is installed to the location where the file (or the path to the file) is found. If None (default), the fileName argument is relative to the installation directory.
Definition at line 172 of file policy.py.
def lsst.daf.persistence.policy.Policy.dump | ( | self, | |
output | |||
) |
i/o #
Writes the policy to a yaml stream. :param stream: :return:
def lsst.daf.persistence.policy.Policy.dumpToFile | ( | self, | |
path | |||
) |
def lsst.daf.persistence.policy.Policy.exists | ( | self, | |
key | |||
) |
Query if a key exists in this Policy :param key: :return: True if the key exists, else false.
def lsst.daf.persistence.policy.Policy.getBool | ( | self, | |
key | |||
) |
Get the value of a key. :param key: :return: the value for key
def lsst.daf.persistence.policy.Policy.getPolicy | ( | self, | |
key | |||
) |
def lsst.daf.persistence.policy.Policy.getString | ( | self, | |
key | |||
) |
Get the string value of a key. :param key: :return: the value for key
def lsst.daf.persistence.policy.Policy.getStringArray | ( | self, | |
key | |||
) |
def lsst.daf.persistence.policy.Policy.getValue | ( | self, | |
name | |||
) |
Get the value for a parameter name/key. See class notes about dot-delimited access. :param name: :return: the value for the given name.
def lsst.daf.persistence.policy.Policy.merge | ( | self, | |
other | |||
) |
Like Policy.update, but will add keys & values from other that DO NOT EXIST in self. Keys and values that already exist in self will NOT be overwritten. :param other: :return:
def lsst.daf.persistence.policy.Policy.mergeDefaults | ( | self, | |
other | |||
) |
For any keys in other that are not present in self, sets that key and its value into self. :param other: another Policy :return: None
Definition at line 283 of file policy.py.
def lsst.daf.persistence.policy.Policy.names | ( | self, | |
topLevelOnly = False |
|||
) |
Get the dot-delimited name of all the keys in the hierarchy. NOTE: this is different than the built-in method dict.keys, which will return only the first level keys.
def lsst.daf.persistence.policy.Policy.ppprint | ( | self | ) |
def lsst.daf.persistence.policy.Policy.setValue | ( | self, | |
name, | |||
value | |||
) |
Set the value for a parameter name/key. See class notes about dot-delimited access. :param name: :return: None
def lsst.daf.persistence.policy.Policy.update | ( | self, | |
other | |||
) |
Like dict.update, but will add or modify keys in nested dicts, instead of overwriting the nested dict entirely. For example, for the given code: foo = {'a': {'b': 1}} foo.update({'a': {'c': 2}}) If foo is a dict, then after the update foo == {'a': {'c': 2}} But if foo is a Policy, then after the update foo == {'a': {'b': 1, 'c': 2}}