From 70f5be89874fe89e65ddee9d3059f914d0720abf Mon Sep 17 00:00:00 2001 From: angloth <angus.lothian@hotmail.com> Date: Thu, 23 Apr 2020 17:33:08 +0200 Subject: [PATCH] Rename find_components_with_type_name to get --- b_asic/signal_flow_graph.py | 6 +++--- test/test_sfg.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/b_asic/signal_flow_graph.py b/b_asic/signal_flow_graph.py index 140f275f..2bbab16c 100644 --- a/b_asic/signal_flow_graph.py +++ b/b_asic/signal_flow_graph.py @@ -269,7 +269,7 @@ class SFG(AbstractOperation): """Get all operations of this graph in depth-first order.""" return self._operations_ordered - def find_components_with_type_name(self, type_name: TypeName) -> List[GraphComponent]: + def get_components_with_type_name(self, type_name: TypeName) -> List[GraphComponent]: """Get a list with all components in this graph with the specified type_name. Keyword arguments: @@ -478,7 +478,7 @@ class SFG(AbstractOperation): results[key] = value return value - def get_precedence_list(self): + def get_precedence_list(self) -> List[List[OutputPort]]: """Returns a Precedence list of the SFG where each element in n:th the list consists of elements that are executed in the n:th step. If the precedence list already has been calculated for the current SFG then returns the cached version.""" @@ -490,7 +490,7 @@ class SFG(AbstractOperation): # Find all operations with only outputs and no inputs. no_input_ops = list( filter(lambda op: op.input_count == 0, self.operations)) - reg_ops = self.find_components_with_type_name(Register.type_name()) + reg_ops = self.get_components_with_type_name(Register.type_name()) # Find all first iter output ports for precedence curr_iter_ports = [op.output(i) for op in ( diff --git a/test/test_sfg.py b/test/test_sfg.py index 25c4de3d..eb31fd86 100644 --- a/test/test_sfg.py +++ b/test/test_sfg.py @@ -290,19 +290,19 @@ class TestFindComponentsWithTypeName: print(mac_sfg._components_by_id) - assert {comp.name for comp in mac_sfg.find_components_with_type_name( + assert {comp.name for comp in mac_sfg.get_components_with_type_name( inp1.type_name())} == {"INP1", "INP2", "INP3"} - assert {comp.name for comp in mac_sfg.find_components_with_type_name( + assert {comp.name for comp in mac_sfg.get_components_with_type_name( add1.type_name())} == {"ADD1", "ADD2"} - assert {comp.name for comp in mac_sfg.find_components_with_type_name( + assert {comp.name for comp in mac_sfg.get_components_with_type_name( mul1.type_name())} == {"MUL1"} - assert {comp.name for comp in mac_sfg.find_components_with_type_name( + assert {comp.name for comp in mac_sfg.get_components_with_type_name( out1.type_name())} == {"OUT1"} - assert {comp.name for comp in mac_sfg.find_components_with_type_name( + assert {comp.name for comp in mac_sfg.get_components_with_type_name( Signal.type_name())} == {"S1", "S2", "S3", "S4", "S5", "S6", "S7"} -- GitLab