ScienceStateAlias¶
-
class
astropy.utils.state.
ScienceStateAlias
[source] [edit on github]¶ Bases:
astropy.config.ConfigItem
This 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
configspec
file 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 ConfigItem
reload
()Reloads the value of this ConfigItem
from 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
ConfigItem
Returns: val
This item’s value, with a type determined by the
cfgtype
attribute.Raises: TypeError
If the configuration value as stored is not this item’s type.
-
reload
()[source] [edit on github]¶ Reloads the value of this
ConfigItem
from 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
value
is 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’ ...
# ITEM is now ‘default’ after the with block
Parameters: value
The value to set this item to inside the with block.
-