core.json_config module¶
Proxy to abstract access to JSON configuration and gracefully handle missing keys.
-
class
core.json_config.
JSONConfiguration
(filename, default=None, warn=True)[source]¶ Bases:
object
Proxy for JSON-based configuration files.
-
get
(path, default=None)[source]¶ Retrieves a value from the configuration. Returns default if the path does not exist.
- Parameters
path –
/
-delimited path to the string.default – value returned if path does not exist.
-
get_bool
(path)[source]¶ Retrieves a value from the configuration. Returns False if the path does not exist.
- Parameters
path –
/
-delimited path to the string.
-
get_dict
(path)[source]¶ Retrieves a value from the configuration. Returns an empty dictionary if the path does not exist.
- Parameters
path –
/
-delimited path to the string.
-
get_list
(path)[source]¶ Retrieves a value from the configuration. Returns an empty list if the path does not exist.
- Parameters
path –
/
-delimited path to the string.
-
get_number
(path)[source]¶ Retrieves a value from the configuration. Returns 0 if the path does not exist.
- Parameters
path –
/
-delimited path to the string.
-
get_string
(path)[source]¶ Retrieves a value from the configuration. Returns an empty string if the path does not exist.
- Parameters
path –
/
-delimited path to the string.
-
get_value
(path, default=None)[source]¶ Retrieves a value from the configuration. Returns default if the path does not exist.
- Parameters
path –
/
-delimited path to the string.default – value returned if path does not exist.
-