ScienceStateAlias¶
-
class
astropy.utils.state.ScienceStateAlias[source] [edit on github]¶ Bases:
astropy.config.ConfigItemThis is a backward compatibility layer for configuration items that moved to ScienceState classes in astropy 0.4.
Parameters: since : str
The version in which the configuration item was converted into science state.
python_name : str
The old name of the Python variable for the configuration item.
config_name : str
The old name of the configuration item in the configuration file.
science_state : ScienceState subclass
The science state class that now manages this information.
cfgtype : str or
None, optionalA type specifier like those used as the values of a particular key in a
configspecfile ofconfigobj. IfNone, the type will be inferred from the default value.module : str, optional
The module containing the old configuration item.
Methods Summary
__call__()Returns the value of this ConfigItemreload()Reloads the value of this ConfigItemfrom the relevant configuration file.set(value)Sets the current value of this ConfigItem.set_temp(*args, **kwds)Sets this item to a specified value only inside a with block. Methods Documentation
-
__call__()[source] [edit on github]¶ Returns the value of this
ConfigItemReturns: val
This item’s value, with a type determined by the
cfgtypeattribute.Raises: TypeError
If the configuration value as stored is not this item’s type.
-
reload()[source] [edit on github]¶ Reloads the value of this
ConfigItemfrom the relevant configuration file.Returns: val
The new value loaded from the configuration file.
-
set(value)[source] [edit on github]¶ Sets the current value of this
ConfigItem.This also updates the comments that give the description and type information.
Parameters: value
The value this item should be set to.
Raises: TypeError
If the provided
valueis not valid for thisConfigItem.
-
set_temp(*args, **kwds)[source] [edit on github]¶ Sets this item to a specified value only inside a with block.
Use as:
ITEM = ConfigItem('ITEM', 'default', 'description') with ITEM.set_temp('newval'): #... do something that wants ITEM's value to be 'newval' ... print(ITEM) # ITEM is now 'default' after the with block
Parameters: value
The value to set this item to inside the with block.
-