Skip to content
Snippets Groups Projects
Commit 664b8044 authored by Jacob Wahlman's avatar Jacob Wahlman :ok_hand:
Browse files

Fixed smaller typing issues and moved traverse test

parent 57456644
No related branches found
No related tags found
3 merge requests!7Resolve "Operation Traversing",!4Operation Tree Traversing,!2Integrated ID system, traversing and som signal tests
Pipeline #9894 passed
......@@ -8,7 +8,7 @@ TODO:
- When we no more out ports can be traversed return results and end.
"""
from typing import List
from typing import List, Optional
from collections import deque
from b_asic.operation import Operation
......@@ -39,16 +39,16 @@ class Traverse:
return visited
def traverse(self, _type: Operation = None) -> List[Operation]:
def traverse(self, type_: Optional[Operation] = None) -> List[Operation]:
"""Traverse the the operation tree and return operation where type matches.
If the type is None then return the entire tree.
Keyword arguments:
_type -- the operation type to search for (default None)
type_-- the operation type to search for (default None)
"""
operations: List[Operation] = self._breadth_first_search(self._initial_operation)
if _type is not None:
operations = [oper for oper in operations if isinstance(oper, _type)]
if type_ is not None:
operations = [oper for oper in operations if isinstance(oper, type_)]
return operations
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment