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'
DEFINITION = 'settings-definitions'
VERSION = 'version'
class armi.settings.settingsIO.SettingsReader(cs)[source]

Bases: armi.settings.settingsIO._SettingsReader

A specialized _SettingsReader which only assigns values to existing settings.

armi.settings.settingsIO.applyTypeConversions(settingObj, value)[source]

Coerce value to proper type given a valid setting object.

Useful in converting XML settings with no type info (all string) as well as in GUI operations.

class armi.settings.settingsIO.SettingsDefinitionReader(cs)[source]

Bases: armi.settings.settingsIO._SettingsReader

A specialized _SettingsReader which creates new setting instances.

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

Bases: object

Writes settings out to files.

This can write in three styles:

definition

setting definitions listing, includes every setting

short

setting values that are not their defaults only

full

all setting values regardless of default status

class Styles[source]

Bases: object

Collection of valid output styles

definition = 'definition'
short = 'short'
full = 'full'
writeXml(stream)[source]

Write settings to XML file.

writeYaml(stream)[source]

Write settings to YAML file.

prettyPrintXmlRecursively(node, indentation=0, spacing=True)[source]

Generates a pretty output string of an element tree better than the default .write()

Uses helper cleanQuotesFromString to get everything both python and xml readable

Parameters
  • node (ET.Element) – the element tree element to write the output for

  • indentation (int,) – not for manual use, but for the recursion to nicely nest parts of the string

  • spacing (bool) – used to flip the newline behavior for spacing out an xml file or keeping it compact primarily for the difference between a default settings and a custom settings file.

cleanStringForXml(s)[source]

Assures no XML entity issues will occur on parsing a string

A helper function used to make strings xml friendly XML has some reserved characters, this should handle them. apostrophes aren’t being dealt with but seem to behave nicely as is.

http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references