config

The config module reads the Natlink config file (natlink.ini), as used by other modules, especially the loader.

class LogLevel(value)[source]

An enumeration.

Return the location of the natlink config files

if NATLINK_SETTINGSDIR is set: return this, but… it should end with “.natlink” if NATLINK_SETTINGSDIR is NOT set: return Path.home()/’.natlink’

expand_path(input_path: str) str[source]

expand path if it starts with “~” or starts with an environment variable or name of python package

Paths can be:

  • the name of a python package, or a sub directory of a python package

  • natlink_settingsdir/…: the directory where natlink.ini is is searched for, either`%(NATLINK_SETTINGSDIR)` or ~/.natlink

  • ~/…: the home directory

  • Obsolete: natlink_userdir/…: instead natlink_settingsdir will be searched for, and a message is thrown. In the config program things are checked more thoroughly.

  • some other environment variable: this environment variable is expanded

The Documents directory can be found by “~Documents”…

When there is nothing to expand, just return the input