configfileindex/home/perette/Projects/Skeezball/TestUtilities/configfile.py

This module loads JSON configuration files. Files can be "merged", such that subsequent files override individual settings provided by previously-loaded files.

Modules

json os sys

Functions

executableDirectory() -> str
findConfigDirectory() -> str

Find the Config directory. See findDirectory().

findDirectory(directory: str) -> str

Locate a project directory.
directory: The directory to locate.
Return value: The path to the directory.

findProjectDirectory(identifier: str) -> str

Find the project directory by looking for an identifier file. It may be:
• Co-located with the running executable
• In the parent directory (project) of the executable
identifier: A flag directory to identify the project root.
Return value: The path to the project's root. If not found, throws FileNotFoundError.

merge(source, destination)

Deep merge two dictionaries.

>>> a = { 'first' : { 'all_rows' : { 'pass' : 'dog', 'number' : '1' } } } >>> b = { 'first' : { 'all_rows' : { 'fail' : 'cat', 'number' : '5' } } } >>> merge(b, a) == { 'first' : { 'all_rows' : { 'pass' : 'dog', 'fail' : 'cat', 'number' : '5' } } } True

mergeConfig(path: str, configuration: dict = {}) -> dict

Merge a configuration file into in-memory configuration. This allows, for example, local configuration files to override program-provided defaults.
path: The pathname of the file to merge. If it does not exist, function treats it as empty, with no error generated.
configuration: The configuration to merge into. This variable is modified.
Return value: The updated configuration.

mergeStandardConfig(file: str, configuration: dict = {}) -> dict

Load or merge a configuration file into in-memory configuration.
file: The filename (no directory) of the file to merge. An exception is thrown if file does not exist.
configuration: The configuration to merge into. This variable is modified.
Return value: The updated configuration.

Data

Any = typing.Any ic = <icecream.icecream.IceCreamDebugger object>