armi.settings.settingsIO module
This module contains classes and methods for reading and writing
Settings, and the contained
Setting.
- class armi.settings.settingsIO.Roots[source]
Bases:
objectXML tree root node common strings.
- CUSTOM = 'settings'
- VERSION = 'version'
- class armi.settings.settingsIO.SettingRenamer(settings: Dict[str, Setting])[source]
Bases:
objectUtility class to help with setting rename migrations.
This class stores a cache of renaming maps, derived from the
Setting.oldNamesvalues of the passedsettings. Expired renames are retained, so that meaningful warning messages can be generated if one attempts to use one of them. The renaming logic follows the rules described inrenameSetting().- renameSetting(name) Tuple[str, bool][source]
Attempt to rename a candidate setting.
- Renaming follows these rules:
If the
namecorresponds to a current setting name, do not attempt to rename it.If the
namedoes not correspond to a current setting name, but is one of the active renames, return the corresponding active rename.If the
namedoes not correspond to a current setting name, but is one of the expired renames, produce a warning and do not rename it.
- Parameters:
name (str) – The candidate setting name to potentially rename.
- Returns:
name (str) – The potentially-renamed setting
renamed (bool) – Whether the setting was actually renamed
- class armi.settings.settingsIO.SettingsReader(cs)[source]
Bases:
objectAbstract class for processing settings files.
ARMI uses the YAML standard for settings files. ARMI uses industry-standard
ruamel.yamlPython library to read these files. ARMI does not bend or change the YAML file format standard in any way.- Parameters:
cs (Settings) – The settings object to read into
- class armi.settings.settingsIO.SettingsWriter(settings_instance, style='short', settingsSetByUser=[])[source]
Bases:
objectWrites settings out to files.
This can write in three styles:
- short
setting values that are not their defaults only
- medium
preserves all settings originally in file even if they match the default value
- full
all setting values regardless of default status
- armi.settings.settingsIO.prompt(statement, question, *options)[source]
Prompt the user for some information.