8787import networkx as nx
8888from boltons .setutils import IndexedSet as iset
8989
90- from .base import Plotter , aslist , astuple , jetsam
90+ from .base import Items , Plotter , aslist , astuple , jetsam
9191from .modifiers import optional , sideffect
9292from .op import Operation
9393
@@ -138,7 +138,7 @@ def __repr__(self):
138138
139139class _EvictInstruction (str ):
140140 """
141- Execution step to evict a computed value from the `solution`.
141+ A step in the ExecutionPlan to evict a computed value from the `solution`.
142142
143143 It's a step in :attr:`ExecutionPlan.steps` for the data-node `str` that
144144 frees its data-value from `solution` after it is no longer needed,
@@ -153,7 +153,7 @@ def __repr__(self):
153153
154154class _PinInstruction (str ):
155155 """
156- Execution step to overwrite a computed value in the `solution` from the inputs,
156+ A step in the ExecutionPlan to overwrite a computed value in the `solution` from the inputs,
157157
158158 and to store the computed one in the ``overwrites`` instead
159159 (both `solution` & ``overwrites`` are local-vars in :meth:`~Network.compute()`).
@@ -266,9 +266,7 @@ def __repr__(self):
266266 "" .join (steps ),
267267 )
268268
269- def validate (
270- self , inputs : Optional [abc .Collection ], outputs : Optional [abc .Collection ]
271- ):
269+ def validate (self , inputs : Items , outputs : Items ):
272270 """
273271 Scream on invalid inputs, outputs or no operations in graph.
274272
@@ -674,8 +672,8 @@ def _apply_graph_predicate(self, graph, predicate):
674672
675673 def _prune_graph (
676674 self ,
677- inputs : Optional [ Collection ] ,
678- outputs : Optional [ Collection ] ,
675+ inputs : Items ,
676+ outputs : Items ,
679677 predicate : Callable [[Any , Mapping ], bool ] = None ,
680678 ) -> Tuple [nx .DiGraph , Collection , Collection , Collection ]:
681679 """
@@ -687,7 +685,6 @@ def _prune_graph(
687685
688686 :param inputs:
689687 The names of all given inputs.
690-
691688 :param outputs:
692689 The desired output names. This can also be ``None``, in which
693690 case the necessary steps are all graph nodes that are reachable
@@ -793,8 +790,8 @@ def _prune_graph(
793790
794791 def pruned (
795792 self ,
796- inputs : Collection = None ,
797- outputs : Collection = None ,
793+ inputs : Items = None ,
794+ outputs : Items = None ,
798795 predicate : Callable [[Any , Mapping ], bool ] = None ,
799796 ) -> "Network" :
800797 """
@@ -824,7 +821,7 @@ def pruned(
824821 return Network (graph = pruned_dag )
825822
826823 def _build_execution_steps (
827- self , pruned_dag , inputs : Optional [ Collection ] , outputs : Optional [Collection ]
824+ self , pruned_dag , inputs : Collection , outputs : Optional [Collection ]
828825 ) -> List :
829826 """
830827 Create the list of operation-nodes & *instructions* evaluating all
@@ -927,11 +924,7 @@ def add_step_once(step):
927924
928925 return steps
929926
930- def compile (
931- self ,
932- inputs : Union [Collection , str ] = None ,
933- outputs : Union [Collection , str ] = None ,
934- ) -> ExecutionPlan :
927+ def compile (self , inputs : Items = None , outputs : Items = None ) -> ExecutionPlan :
935928 """
936929 Create or get from cache an execution-plan for the given inputs/outputs.
937930
0 commit comments