Configuration file routines (config
)#
Functions:
|
Find the config file |
|
Create a configuration file. |
Classes:
|
Configuration handler |
- open_notebook.config.get_config_files(cwd='.', home=None, config_name='.open-notebook.toml')[source]#
Find the config file
Order for search is "current directory", "git root", "user home".
- class open_notebook.config.Config(data, default_params=None)[source]#
Bases:
object
Configuration handler
Accepts multiple mappings. Will parse them left to right for matches
Methods:
get
(*keys[, default, factory])Get value from config(s)
get_option
(key[, passed, section, default, ...])Get option value from either passed in option, or from config file (left to right).
- get_option(key, passed=_Missing.MISSING, section=None, default=_Missing.MISSING, factory=None)[source]#
Get option value from either passed in option, or from config file (left to right).
Order of checking is:
passed
data[section][key] for data in self.data.
data[key] for data in self.data.
factory
default
- Parameters:
key (
str
, optional) -- key to look for.passed (default
MISSING
) -- Passed in value. If not MISSING, this will be the returned value.section (
str
, optional) -- The table section to check. Fall back to top level of any dict.factory (
callable()
, optional) -- If no value found, return factory().default -- Fallback value to return