Skip to content
Snippets Groups Projects
Commit 74e29536 authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Fix Parameters differ from overridden 'process' method

parent c9936bd3
No related branches found
No related tags found
1 merge request!3Version 0.2
......@@ -10,7 +10,8 @@ class KCliqueCommunity(EpochCommunity):
self.k = k
self.threshold = threshold
def process(self, network):
def process(self, **kwargs):
network = kwargs['network']
while True:
yield self.tick()
g = self.next_epoch(self.env.now)
......
......@@ -10,7 +10,8 @@ class LouvainCommunity(EpochCommunity):
def __init__(self, epoch=604800, **kwargs):
super().__init__(epoch, **kwargs)
def process(self, network):
def process(self, **kwargs):
network = kwargs['network']
while True:
yield self.tick()
g = self.next_epoch(self.env.now)
......
......@@ -7,9 +7,9 @@ class Process:
self.env = env
self.__process = env.process(self.process(*args))
def process(self, *args):
def process(self, **kwargs):
yield self.env.timeout(0)
raise NotImplementedError
yield None
class TickProcess(Process):
......
......@@ -135,7 +135,7 @@ class Node(TickProcess):
for packet in packets_to_delete:
self.buffer.remove(packet)
def process(self):
def process(self, **kwargs):
''''''
while True:
self.buffer.clean()
......@@ -232,7 +232,8 @@ class PacketGenerator(TickProcess):
self.time_to_live = time_to_live
self.packets = []
def process(self, network):
def process(self, **kwargs):
network = kwargs['network']
packet_id = 0
def create(packet_id):
source, dest = random.choice(network.links)
......
......@@ -15,9 +15,10 @@ class CSVTrace(Trace):
duration, _, _, nodes = map(int, next(self.reader))
super().__init__(duration, nodes)
def process(self, network):
def process(self, **kwargs):
''''''
env = self.env
network = kwargs['network']
for row in self.reader:
time, a, b, state = map(int, row)
......
......@@ -20,10 +20,10 @@ class RandomTrace(TickTrace):
self.min_toggles = min_toggles
self.max_toggles = max_toggles
def process(self, network):
def process(self, **kwargs):
''''''
env = self.env
links = network.links
links = kwargs['network'].links
while env.now < self.duration:
to_toggle = randint(self.min_toggles, self.max_toggles)
......
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