Details
-
Type:
Improvement
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: pex_config
-
Labels:None
-
Team:Architecture
Description
Alex Drlica-Wagner reports:
I've been trying to access the configurable options for a "nested" config like ProcessCcdConfig (i.e., a config that contains other ConfigurableInstance objects). I would have thought that something like this would work to give me the help string for an IsrTaskConfig object, but instead I get the help for a ConfigurableInstance
from lsst.pipe.tasks.processCcd import ProcessCcdConfig |
config = ProcessCcdConfig() |
help(config.isr) |
and the output:
Help on ConfigurableInstance in module lsst.pex.config.configurableField object:
|
|
class ConfigurableInstance(builtins.object)
|
| Methods defined here:
|
...
|
This is continuing off of a Slack conversation with Jonathan Sick Merlin Fisher-Levine Paul Price.
Merlin Fisher-Levine then responded:
I think that the root of this is also what causes help(config.<int_field>)
to return the help for an int, rather than the docstring and options
for that int-field in the config. If it's somehow not, that's something
to fix too...
Attachments
Issue Links
- links to
These are asking for two different things. In the first case, the ConfigurableField requires another level of indirection. help(config.isr.value) gets you to what you want, although I agree that the extra level is undesirable. It looks like there was an attempt to bring the ConfigurableField value's documentation into the ConfigurableInstance instance, but changing an instance's __doc__ value doesn't actually change what help(instance) returns; that appears to always be based on the type, and changing ConfigurableInstance's class documentation would not be appropriate.
In the second case, the request is for help on a variable instead of a type. Python doesn't normally support this; only types and methods get help. To get the options for a field in a Config subclass, you need to run help on that Config type or an instance of it.