conf Package¶
conf Package¶
Tools for processing configuration files.
-
class
pyfusion.conf.PyfusionConfigParser(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False)[source]¶ Bases:
ConfigParser.ConfigParserCustomised parser to facilitate [Type:Name] config sections.
Inherited ConfigParser methods are extended, and prefixed with pf_ to allow separate arguments for section type and section name, for example:
ConfigParser.has_section(sectionname) -> PyfusionConfigParser.pf_has_section(sectiontype, name)The inherited ConfigParser methods are still available, so the following are identical:
PyfusionConfigParser.has_section(‘Device:TJII’) PyfusionConfigParser.pf_has_section(‘Device’,’TJII’)
exceptions Module¶
Exceptions for the pyfusion config parser.
-
exception
pyfusion.conf.exceptions.ConfigSectionSyntaxError(section_name)[source]¶ Bases:
exceptions.ExceptionConfig file has a malformed section label.
tests Module¶
Tests for pyfusion configuration files and parser.
-
class
pyfusion.conf.tests.CheckConfigFileSectionNames[source]¶ Bases:
pyfusion.test.tests.PfTestBaseCheck section name conformity in configuration files.
Allowed config section names must correspond to those described in the documentation (which should be the same list as pyfusion.conf.allowed_section_types).
-
class
pyfusion.conf.tests.CheckConfigUtils[source]¶ Bases:
pyfusion.test.tests.PfTestBaseTest utilities for handling config files
-
class
pyfusion.conf.tests.CheckImportFromString[source]¶ Bases:
pyfusion.test.tests.PfTestBaseTest import_from_str fuction.
-
class
pyfusion.conf.tests.CheckImportSetting[source]¶ Bases:
pyfusion.test.tests.PfTestBaseTest import_setting function.
-
class
pyfusion.conf.tests.CheckKeywordArgConfigHandler[source]¶ Bases:
pyfusion.test.tests.PfTestBaseTest the function which chooses from kwargs oor config vars.
-
class
pyfusion.conf.tests.CheckPyfusionConfigParser[source]¶ Bases:
pyfusion.test.tests.PfTestBaseTest pyfusion customised config file parser.
-
class
pyfusion.conf.tests.CheckVariableTypes[source]¶ Bases:
pyfusion.test.tests.PfTestBaseCheck that config parser returns correct types for settings.
utils Module¶
Useful functions for manipulating config files.
-
pyfusion.conf.utils.CannotImportFromConfigError(Exception)[source]¶ Failed to import a module, class or method from config setting.
-
pyfusion.conf.utils.diff(dumpa=None, dumpb=None, eol='\n')[source]¶ use /usr/bin/diff or alternative in PYFUSION_DIFF to show the differences adding a config file made.
With no args, the last two differences are shown. Otherwise args must be history dict entries (not just keys) e.g. pyfusion.conf.utils.diff(pyfusion.conf.history[0],pyfusion.conf.history[1])
key gives the read sequence of files - this would be lost in a dictionary key = 0 is the first read
-
pyfusion.conf.utils.dump(eol='\n')[source]¶ dump the present state of the config data with the history of config file names loaded at the end