lsst.dax.apdb g9290983e33+d2d81de7f7
 
Loading...
Searching...
No Matches
lsst.dax.apdb.apdbConfigFreezer.ApdbConfigFreezer Class Reference
Inheritance diagram for lsst.dax.apdb.apdbConfigFreezer.ApdbConfigFreezer:

Public Member Functions

 __init__ (self, Iterable[str] field_names)
 
str to_json (self, ApdbConfig config)
 
_Config update (self, _Config config, str json_str)
 

Protected Attributes

 _field_names = list(field_names)
 
dict _getters = {name.split(".")[-1]: attrgetter(name) for name in self._field_names}
 
dict _attr_parents = {}
 

Detailed Description

Class that handles freezing of the configuration parameters, this is
an implementation detail for use in Apdb subclasses.

Parameters
----------
field_names : `~collections.abc.Iterable` [`str`]
    Names of configuration fields to be frozen, they can be hierarchical
    (dot-separated).

Member Function Documentation

◆ to_json()

str lsst.dax.apdb.apdbConfigFreezer.ApdbConfigFreezer.to_json ( self,
ApdbConfig config )
Convert part of the configuration object to JSON string.

Parameters
----------
config : `ApdbConfig`
    Configuration object.

Returns
-------
json_str : `str`
    JSON representation of the frozen part of the config. For
    hierarchical dot-separated names only that last part of the name is
    used in the returned JSON mapping.

◆ update()

_Config lsst.dax.apdb.apdbConfigFreezer.ApdbConfigFreezer.update ( self,
_Config config,
str json_str )
Update configuration field values from a JSON string.

Parameters
----------
config : `ApdbConfig`
    Configuration object.
json_str : str
    String containing JSON representation of configuration.

Returns
-------
updated : `ApdbConfig`
    Copy of the ``config`` with some fields updated from JSON object.

Raises
------
TypeError
    Raised if JSON string does not represent JSON object.
ValueError
    Raised if JSON object contains key which is not present in
    ``field_names``.

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