Package yapydata :: Package datatree :: Module synini

Module synini

source code

The YapyData.ini module provides the extended INI file syntax access with optional extended syntax features. The core syntax is defined by the standard library configparser.ConfigParser, YapyData.data supports Python2.7, and Python3.5+.

Version: 0.1.1

Author: Arno-Can Uestuensoez

License: Artistic-License-2.0 + Forced-Fairplay-Constraints

Classes
  YapyDataINIError
Generic INI syntax error.
  MultiOrderedDict
Add lists for multi-key items.
  CaseSensitiveConfigParser
Preserves case of all keys - including DEFAULT section. Suppress formatting of optionstr, preserves upper case characters.
  DataTreeINI
The the supported in-memory data tree representation of the INI syntax supports a JSON compatible in memory data structure. The supported structure relies on the standard ConfigParser - of Python2 and Python3 - with a minimum set of custom addons. For a full set of extensions refer to the package multiconf.
  ConfigDataINIX
A simple configuration file parser based on the standard ConfigParser class.
Functions
 
grow_branch(*subpath, **kargs)
Creates a new branch including the assigned value to the last node. The node types are defined by the types of the subpath entries.
source code
 
readout_data(xval, **kargs)
Scan tree into JSON representation. Uses recursive calls to readout_data through the logical tree spanned by ConfigParser.
source code
Variables
  __uuid__ = "60cac28d-efe6-4a8d-802f-fa4fc94fa741"
Function Details

grow_branch(*subpath, **kargs)

source code 

Creates a new branch including the assigned value to the last node. The node types are defined by the types of the subpath entries.

Supports a single linear branch only, no sub-branching.

The created path is validated for permitted types. The derived types such as JSON have to support their own branch method. Thus provided as a static method.

Args:
subpath:
Variable list/tuple of path keys and indexes.
kargs:
value:
Value to be assigned to the final node.
Returns:
A created branch.
Raises:
pass-through
Decorators:

readout_data(xval, **kargs)

source code 

Scan tree into JSON representation. Uses recursive calls to readout_data through the logical tree spanned by ConfigParser.

Args:
xval:

The loaded input tree as received from ConfigDataINIX, which is defined by ConfigParser.read_file().

For example a node cf:

datafile = os.path.abspath(fpname)
cf = ConfigDataINIX(datafile)
cf.load_parser()
cf.import_data(datafile)

is read out as

datatree = readout_data(cf)
Returns:
The resulting scanned data structure.
Raises:
pass-through
Decorators: