22__all__ = (
"Info",
"getDebugFrame")
29 """An object cognisant of debugging parameters appropriate for module
32 Any request for a value will
return False unless that value has
33 been set, either
in the module
or as an attribute of this object.
37 .. code-block:: python
43 will set display to `
False`, unless display has been set
with
45 .. code-block:: python
49 Why
is this interesting? Because you can replace `
lsstDebug.Info`
with
50 your own version, e.g.
52 .. code-block:: python
60 di.display = dict(repair=1, background=2, calibrate=3)
74 Raised
if ``modname``
is not loaded.
78 self.__dict__[
"_dict"] = sys.modules[modname].__dict__
82 """Return the value of the variable "what" in ``self.__modname``
84 return self._dict.get(what,
False)
87 """Set the value of the variable "what" in ``self.__modname``
89 self._dict[what] = value
97 Attempt to extract a frame for displaying a product called ``name``
98 from the ``debugDisplay`` variable.
100 Per the above, an instance of `Info` can
return an arbitrary object
101 (
or nothing)
as its ``display`` attribute. It
is convenient -- though
not
102 required -- that it be a dictionary mapping data products to frame
103 numbers,
as shown
in the `
lsstDebug.Info` example. Given such a dictionary,
104 this function extracts
and returns the appropriate frame number. If
105 ``debugDisplay``
is not a collection,
or if ``name``
is not found within
106 it, we
return `
None`.
110 debugDisplay : `object`
113 The name of the data product to be displayed.
118 A frame number,
or `
None`.
120 if hasattr(debugDisplay,
"__contains__")
and name
in debugDisplay:
121 return debugDisplay[name]
def __setattr__(self, what, value)
def __getattr__(self, what)
def __init__(self, modname)
def getDebugFrame(debugDisplay, name)