config – The configuration functionality and files

The Core

Manage configuration

Mostly copied from vhc/libvhc/config.py

exception vdat.config.core.ConfigurationError[source]

Generic error raised by the configuration sub-package

exception vdat.config.core.MissingConfigurationError[source]

Raised when a configuration item does not exist

exception vdat.config.core.MissingConfigurationSectionError[source]

Raised when a configuration section does not exist

vdat.config.core.load_yaml(name, *fnames)[source]

Load YAML configuration files. Skip non existing files.

Parameters:

name : string

name to associate to the configurations

fnames : list of strings

the filename(s) of the configuration files

Returns:

flist : list

files successfully loaded

vdat.config.core.load_std_conf(name, *fnames)[source]

Load standard configuration files

Parameters:

name : string

name to associate to the configurations

fnames : list of strings

the filename(s) of the configuration files

Returns:

flist : list

files successfully loaded

vdat.config.core.load_all_configs(vdat_conf_fname)[source]

Convenience function to load the vdat configuration files.

It loads:

  • "main": the standard configuration file vdat_conf_fname; given from the command line
  • "tab": the yaml file(s) that instruct the gui how to display the files; the names are in the tab_config of the general section of the “default” configuration
Parameters:

vdat_conf_fname : string

name of the file with the vdat configuration

name : string

name under which the configuration object is saved

vdat.config.core.get_config(name, section=None)[source]

Returns the configuration file with the specified name.

Parameters:

name : string, optional

name associated with the configuration object; by default returns the main configuration

section : string, optional

optionally returns only one section

Returns:

configuration object

can be either a ConfigParser or a dictionary(-like) object

The vdat_config executable

Implementation of the vdat_config entry point

vdat.config.entry_point.COPY_FILES = [u'vdat_setting.cfg', u'tabs.yml', u'fplane.txt', u'vdat_commands.yml', u'buttons.yml']

Files copied from the package

vdat.config.entry_point.COPY_DIR = [u'extra_files']

The files in the following subdirectories are copied too

vdat.config.entry_point.main(argv=None)[source]

Main function of the implementation of the vdat_config executable

Parameters:

argv : list

command line, if None taken from sys.argv

vdat.config.entry_point.parse(argv=None)[source]

Create the parser and parse the command line arguments

Parameters:

argv : list

command line, if None taken from sys.argv

Returns:

Namespace

parsed command line

vdat.config.entry_point._encode(str_)[source]

In python 3 encodes the string into bytes, in python 2 returns the input

Parameters:

str_ : string type

string to encode

Returns

bytes

vdat.config.entry_point.copy(args)[source]

Copy the configuration files

Parameters:

args : Namespace

arguments to make the copy run

Todo

include configuration files?