:mod:`snowmobile.core.configuration` ==================================== .. py:module:: snowmobile.core.configuration .. autoapi-nested-parse:: snowmobile.core.Configuration is a parsed snowmobile.toml file; class handles: 1. Locating `snowmobile.toml`, from: a. A cached location specific to the version of :xref:`snowmobile` and the file name (defaults to `snowmobile.toml`) b. 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 2. Checking **[ext-sources]** for specified external configurations 3. Instantiating each section in snowmobile.toml from the (Pydantic) models defined in :mod:`snowmobile.core.cfg`; root sections are set as individual attributes on :class:`~snowmobile.core.configuration.Configuration` Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: snowmobile.core.configuration.Configuration .. class:: 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: :class:`snowmobile.core.base.Generic` A parsed `snowmobile.toml` file. *All keyword arguments optional.* :param config_file_nm: Name of configuration file to use; defaults to `snowmobile.toml`. :type config_file_nm: Optional[str] :param creds: 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`. :type creds: Optional[str] :param from_config: 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. :type from_config: Optional[str, Path] :param export_dir: 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. :type export_dir: Optional[Path] .. attribute:: file_nm Configuration file name; defaults to 'snowmobile.toml'. :type: str .. attribute:: cache Persistent cache; caches :attr:`location`. :type: snowmobile.core.cache.Cache .. attribute:: location Full path to configuration file. :type: pathlib.Path .. attribute:: connection :annotation: :Optional[cfg.Connection] **[connection]** from snowmobile.toml. :type: snowmobile.core.cfg.Connection .. attribute:: loading :annotation: :Optional[cfg.Loading] **[loading]** from snowmobile.toml. :type: snowmobile.core.cfg.Loading .. attribute:: script :annotation: :Optional[cfg.Script] **[script]** from snowmobile.toml. :type: snowmobile.core.cfg.Script .. attribute:: sql :annotation: :Optional[cfg.SQL] **[sql]** from snowmobile-ext.toml. :type: snowmobile.core.cfg.SQL .. attribute:: ext_sources :annotation: :Optional[cfg.Location] **[external-sources]** from snowmobile.toml. :type: snowmobile.core.cfg.Location .. method:: markdown(self) -> snowmobile.core.cfg.Markup :property: Accessor for cfg.script.markdown. .. method:: attrs(self) -> snowmobile.core.cfg.Attributes :property: Accessor for cfg.script.markdown.attributes. .. method:: wildcards(self) -> snowmobile.core.cfg.Wildcard :property: Accessor for cfg.script.patterns.wildcards. .. method:: batch_set_attrs(obj: Any, attrs: dict, to_none: bool = False) :staticmethod: Batch sets attributes on an object from a dictionary. :param obj: Object to set attributes on. :type obj: Any :param attrs: Dictionary containing attributes. :type attrs: dict :param to_none: Set all of the object's attributes batching a key in `wrap` to `None`; defaults ot `False`. :type to_none: bool Returns (Any): Object post-setting attributes. .. method:: attrs_from_obj(obj: Any, within: Optional[List[str]] = None) -> Dict[(str, MethodType)] :staticmethod: Utility to return attributes/properties from an object as a dictionary. .. method:: methods_from_obj(obj: Any, within: Optional[List[str]] = None) -> Dict[(str, MethodType)] :staticmethod: Returns callable components of an object as a dictionary. .. method:: scopes(self) :property: All combinations of scope type and scope attribute. .. method:: scopes_from_kwargs(self, only_populated: bool = False, **kwargs) -> Dict Turns *script.filter()* arguments into a valid set of kwargs for :class:`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. .. method:: scopes_from_tag(self, t: Any) Generates list of keyword arguments to instantiate all scopes for a wrap. .. method:: json(self, by_alias: bool = False, **kwargs) Serialization method for core object model.