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

Method normalize

invoke/executor.py:151–179  ·  view source on GitHub ↗

Transform arbitrary task list w/ various types, into `.Call` objects. See docstring for `~.Executor.execute` for details. .. versionadded:: 1.0

(
        self,
        tasks: Tuple[
            Union[str, Tuple[str, Dict[str, Any]], ParserContext], ...
        ],
    )

Source from the content-addressed store, hash-verified

149 return results
150
151 def normalize(
152 self,
153 tasks: Tuple[
154 Union[str, Tuple[str, Dict[str, Any]], ParserContext], ...
155 ],
156 ) -> List["Call"]:
157 """
158 Transform arbitrary task list w/ various types, into `.Call` objects.
159
160 See docstring for `~.Executor.execute` for details.
161
162 .. versionadded:: 1.0
163 """
164 calls = []
165 for task in tasks:
166 name: Optional[str]
167 if isinstance(task, str):
168 name = task
169 kwargs = {}
170 elif isinstance(task, ParserContext):
171 name = task.name
172 kwargs = task.as_kwargs
173 else:
174 name, kwargs = task
175 c = Call(self.collection[name], kwargs=kwargs, called_as=name)
176 calls.append(c)
177 if not tasks and self.collection.default is not None:
178 calls = [Call(self.collection[self.collection.default])]
179 return calls
180
181 def dedupe(self, calls: List["Call"]) -> List["Call"]:
182 """

Callers 1

executeMethod · 0.95

Calls 1

CallClass · 0.85

Tested by

no test coverage detected