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

Method to_contexts

invoke/collection.py:423–449  ·  view source on GitHub ↗

Returns all contained tasks and subtasks as a list of parser contexts. :param bool ignore_unknown_help: Passed on to each task's ``get_arguments()`` method. See the config option by the same name for details. .. versionadded:: 1.0 .. version

(
        self, ignore_unknown_help: Optional[bool] = None
    )

Source from the content-addressed store, hash-verified

421 return False
422
423 def to_contexts(
424 self, ignore_unknown_help: Optional[bool] = None
425 ) -> List[ParserContext]:
426 """
427 Returns all contained tasks and subtasks as a list of parser contexts.
428
429 :param bool ignore_unknown_help:
430 Passed on to each task's ``get_arguments()`` method. See the config
431 option by the same name for details.
432
433 .. versionadded:: 1.0
434 .. versionchanged:: 1.7
435 Added the ``ignore_unknown_help`` kwarg.
436 """
437 result = []
438 for primary, aliases in self.task_names.items():
439 task = self[primary]
440 result.append(
441 ParserContext(
442 name=primary,
443 aliases=aliases,
444 args=task.get_arguments(
445 ignore_unknown_help=ignore_unknown_help
446 ),
447 )
448 )
449 return result
450
451 def subtask_name(self, collection_name: str, task_name: str) -> str:
452 return ".".join(

Calls 2

ParserContextClass · 0.85
get_argumentsMethod · 0.80

Tested by

no test coverage detected