snowmobile.core.configuration
¶
snowmobile.core.Configuration is a parsed snowmobile.toml file; class handles:
Locating snowmobile.toml, from:
A cached location specific to the version of snowmobile and the file name (defaults to snowmobile.toml)
Finding a file based on its name from traversing the file system, used when initially finding snowmobile.toml or when a bespoke configuration file name has been provided
Checking [ext-sources] for specified external configurations
Instantiating each section in snowmobile.toml from the (Pydantic) models defined in
snowmobile.core.cfg
; root sections are set as individual attributes onConfiguration
Module Contents¶
Classes¶
A parsed snowmobile.toml file. |
- class
snowmobile.core.configuration.
Configuration
(creds: Optional[str] = None, config_file_nm: Optional[str] = None, from_config: Optional[Path, str] = None, export_dir: Optional[Path, str] = None, silence: bool = False)¶ Bases:
snowmobile.core.base.Generic
A parsed snowmobile.toml file.
All keyword arguments optional.
- Parameters
config_file_nm (Optional[str]) – Name of configuration file to use; defaults to snowmobile.toml.
creds (Optional[str]) – Alias for the set of credentials to authenticate with; default behavior will fall back to the connection.default-creds specified in snowmobile.toml, or the first set of credentials stored if this configuration option is left blank.
from_config (Optional[str, Path]) – A full path to a specific configuration file to use; bypasses any checks for a cached file location and can be useful for container-based processes with restricted access to the local file system.
export_dir (Optional[Path]) – Path to save a template snowmobile.toml file to; if pr, the file will be exported within the __init__ method and nothing else will be instantiated.
-
location
¶ Full path to configuration file.
- Type
-
connection
:Optional[cfg.Connection]¶ [connection] from snowmobile.toml.
-
loading
:Optional[cfg.Loading]¶ [loading] from snowmobile.toml.
-
script
:Optional[cfg.Script]¶ [script] from snowmobile.toml.
-
sql
:Optional[cfg.SQL]¶ [sql] from snowmobile-ext.toml.
-
ext_sources
:Optional[cfg.Location]¶ [external-sources] from snowmobile.toml.
- property
markdown
(self) → snowmobile.core.cfg.Markup¶ Accessor for cfg.script.markdown.
- property
attrs
(self) → snowmobile.core.cfg.Attributes¶ Accessor for cfg.script.markdown.attributes.
- property
wildcards
(self) → snowmobile.core.cfg.Wildcard¶ Accessor for cfg.script.patterns.wildcards.
- static
batch_set_attrs
(obj: Any, attrs: dict, to_none: bool = False)¶ Batch sets attributes on an object from a dictionary.
- Parameters
- Returns (Any):
Object post-setting attributes.
- static
attrs_from_obj
(obj: Any, within: Optional[List[str]] = None) → Dict[str, MethodType]¶ Utility to return attributes/properties from an object as a dictionary.
- static
methods_from_obj
(obj: Any, within: Optional[List[str]] = None) → Dict[str, MethodType]¶ Returns callable components of an object as a dictionary.
- property
scopes
(self)¶ All combinations of scope type and scope attribute.
-
scopes_from_kwargs
(self, only_populated: bool = False, **kwargs) → Dict¶ Turns script.filter() arguments into a valid set of kwargs for
Scope
.Returns dictionary of all combinations of ‘arg’ (“kw”, “obj”, “desc”, “anchor” and “nm”), including empty sets for any ‘arg’ not included in the keyword arguments provided.
-
scopes_from_tag
(self, t: Any)¶ Generates list of keyword arguments to instantiate all scopes for a wrap.