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: object

XML tree root node common strings

CUSTOM = 'settings'
VERSION = 'version'
class armi.settings.settingsIO.SettingRenamer(settings: Dict[str, armi.settings.setting.Setting])[source]

Bases: object

Utility class to help with setting rename migrations.

This class stores a cache of renaming maps, derived from the Setting.oldNames values of the passed settings. 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 in renameSetting().

renameSetting(name) Tuple[str, bool][source]

Attempt to rename a candidate setting.

Renaming follows these rules:
  • If the name corresponds to a current setting name, do not attempt to rename it.

  • If the name does not correspond to a current setting name, but is one of the active renames, return the corresponding active rename.

  • If the name does 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: object

Abstract class for processing settings files.

Parameters

cs (CaseSettings) – The settings object to read into

class SettingsInputFormat(value)[source]

Bases: enum.Enum

An enumeration.

YAML = 1
classmethod fromExt(ext)[source]
readFromFile(path, handleInvalids=True)[source]

Load file and read it.

readFromStream(stream, handleInvalids=True, fmt=SettingsInputFormat.YAML)[source]

Read from a file-like stream.

class armi.settings.settingsIO.SettingsWriter(settings_instance, style='short', settingsSetByUser=[])[source]

Bases: object

Writes 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

writeYaml(stream)[source]

Write settings to YAML file.

armi.settings.settingsIO.prompt(statement, question, *options)[source]

Prompt the user for some information.

exception armi.settings.settingsIO.RunLogPromptCancel[source]

Bases: Exception

An error that occurs when the user submits a cancel on a runLog prompt which allows for cancellation

exception armi.settings.settingsIO.RunLogPromptUnresolvable[source]

Bases: Exception

An error that occurs when the current mode enum in armi.__init__ suggests the user cannot be communicated with from the current process.