MCPcopy Index your code
hub / github.com/pyinvoke/invoke / load_shell_env

Method load_shell_env

invoke/config.py:786–809  ·  view source on GitHub ↗

Load values from the shell environment. `.load_shell_env` is intended for execution late in a `.Config` object's lifecycle, once all other sources (such as a runtime config file or per-collection configurations) have been loaded. Loading from the shell is no

(self)

Source from the content-addressed store, hash-verified

784 self._load_file(prefix="runtime", absolute=True, merge=merge)
785
786 def load_shell_env(self) -> None:
787 """
788 Load values from the shell environment.
789
790 `.load_shell_env` is intended for execution late in a `.Config`
791 object's lifecycle, once all other sources (such as a runtime config
792 file or per-collection configurations) have been loaded. Loading from
793 the shell is not terrifically expensive, but must be done at a specific
794 point in time to ensure the "only known config keys are loaded from the
795 env" behavior works correctly.
796
797 See :ref:`env-vars` for details on this design decision and other info
798 re: how environment variables are scanned and loaded.
799
800 .. versionadded:: 1.0
801 """
802 # Force merge of existing data to ensure we have an up to date picture
803 debug("Running pre-merge for shell env loading...")
804 self.merge()
805 debug("Done with pre-merge.")
806 loader = Environment(config=self._config, prefix=self._env_prefix)
807 self._set(_env=loader.load())
808 debug("Loaded shell environment, triggering final merge")
809 self.merge()
810
811 def load_collection(
812 self, data: Dict[str, Any], merge: bool = True

Calls 4

mergeMethod · 0.95
loadMethod · 0.95
EnvironmentClass · 0.85
_setMethod · 0.80

Tested by

no test coverage detected