Yaml Parser¶
- class django_docker_helpers.config.backends.yaml_parser.YamlParser(config=None, path_separator='.', scope=None)[source]¶
Provides a simple interface to read config options from Yaml.
Example:
p = YamlParser('./tests/data/config.yml', scope='development') assert p.get('up.down.above') == [1, 2, 3]
- Parameters
config (
Union
[str
,TextIO
,None
]) – a path to config file, or TextIO objectpath_separator (
str
) – specifies which character separates nested variables, default is'.'
scope (
Optional
[str
]) – a global namespace-like variable prefix
- Raises
ValueError – if no config specified
- get(variable_path, default=None, coerce_type=None, coercer=None, **kwargs)[source]¶
Inherited method should take all specified arguments.
- Parameters
variable_path (
str
) – a delimiter-separated path to a nested valuedefault (
Optional
[Any
]) – default value if there’s no object by specified pathcoerce_type (
Optional
[Type
]) – cast a type of a value to a specified onecoercer (
Optional
[Callable
]) – perform a type casting with specified callbackkwargs – additional arguments inherited parser may need
- Returns
value or default