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

Method load_collection

invoke/program.py:702–729  ·  view source on GitHub ↗

Load a task collection based on parsed core args, or die trying. .. versionadded:: 1.0

(self)

Source from the content-addressed store, hash-verified

700 debug(msg.format(self.core, self.core.unparsed))
701
702 def load_collection(self) -> None:
703 """
704 Load a task collection based on parsed core args, or die trying.
705
706 .. versionadded:: 1.0
707 """
708 # NOTE: start, coll_name both fall back to configuration values within
709 # Loader (which may, however, get them from our config.)
710 start = self.args["search-root"].value
711 loader = self.loader_class( # type: ignore
712 config=self.config, start=start
713 )
714 coll_name = self.args.collection.value
715 try:
716 module, parent = loader.load(coll_name)
717 # This is the earliest we can load project config, so we should -
718 # allows project config to affect the task parsing step!
719 # TODO: is it worth merging these set- and load- methods? May
720 # require more tweaking of how things behave in/after __init__.
721 self.config.set_project_location(parent)
722 self.config.load_project()
723 self.collection = Collection.from_module(
724 module,
725 loaded_from=parent,
726 auto_dash_names=self.config.tasks.auto_dash_names,
727 )
728 except CollectionNotFound as e:
729 raise Exit("Can't find any collection named {!r}!".format(e.name))
730
731 def _update_core_context(
732 self, context: ParserContext, new_args: Dict[str, Any]

Callers 1

parse_collectionMethod · 0.95

Calls 5

ExitClass · 0.85
set_project_locationMethod · 0.80
load_projectMethod · 0.80
from_moduleMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected