Skip to content
Snippets Groups Projects
Commit 221bf89f authored by Jammer, Tim's avatar Jammer, Tim
Browse files

Refactoring: Renamed Parameter

parent 983c7710
No related branches found
No related tags found
1 merge request!6More Work on infrastructure IV
......@@ -187,7 +187,7 @@ class TemplateManager:
raise ValueError("Neither Both block name nor index is given")
def insert_block(self, new_block, block_name=None, idx=None):
def insert_block(self, new_block, after_block_name=None, after_idx=None):
"""
inserts the given Instruction Block AFTER the one specified Either by name or by index
Raises IndexError if the specified block is not found
......@@ -195,13 +195,13 @@ class TemplateManager:
Raises ValueError if Both a block name and index are given (or none is given)
Args:
new_block (InstructionBlock): the block to insert
block_name (str): The name of the InstructionBlock to receive
idx (int): index of the InstructionBlock to retrieve
after_block_name (str): The name of the InstructionBlock to receive
after_idx (int): index of the InstructionBlock to retrieve
"""
if block_name is not None:
if idx is not None:
if after_block_name is not None:
if after_idx is not None:
raise ValueError("Both block name and index are given")
to_return = [b for b in self._blocks if b.name == block_name]
to_return = [b for b in self._blocks if b.name == after_block_name]
if len(to_return) == 0:
raise IndexError("Block Not Found")
if len(to_return) > 1:
......@@ -209,10 +209,10 @@ class TemplateManager:
self._blocks.insert(self._blocks.index(to_return[0]) + 1, new_block)
return
if idx is not None:
if block_name is not None:
if after_idx is not None:
if after_block_name is not None:
raise ValueError("Both block name and index are given")
self._blocks.insert(idx + 1, new_block)
self._blocks.insert(after_idx + 1, new_block)
return
raise ValueError("Neither Both block name nor index is given")
......
......@@ -72,10 +72,10 @@ class InvalidCommErrorP2P(ErrorGenerator):
if comm_to_use in self.missmatching_comms and comm_to_use != "MPI_COMM_SELF":
b = get_communicator(comm_to_use,comm_to_use)
tm.insert_block(b, block_name="alloc")
tm.insert_block(b, after_block_name="alloc")
if comm_to_use in self.intercomms:
b = get_intercomm(comm_to_use,comm_to_use)
tm.insert_block(b, block_name="alloc")
tm.insert_block(b, after_block_name="alloc")
error_string = "ParamMatching"
if comm_to_use in self.invalid_comm:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment