From 6334d1c779db3138a20e8432b742b0d4b208e21b Mon Sep 17 00:00:00 2001 From: Leonardo Bautista-Gomez Date: Wed, 8 Feb 2023 20:10:26 +0100 Subject: [PATCH] Removing static variables --- DAS/block.py | 2 -- DAS/configuration.py | 1 - DAS/observer.py | 14 ++++++-------- DAS/results.py | 4 ---- DAS/shape.py | 6 ------ DAS/simulator.py | 13 +++++-------- DAS/validator.py | 5 ----- config.das => config.ini | 0 8 files changed, 11 insertions(+), 34 deletions(-) rename config.das => config.ini (100%) diff --git a/DAS/block.py b/DAS/block.py index aa5fe01..1cea8c0 100644 --- a/DAS/block.py +++ b/DAS/block.py @@ -6,8 +6,6 @@ from bitarray.util import zeros class Block: - blockSize = 0 - data = bitarray() def __init__(self, blockSize): self.blockSize = blockSize diff --git a/DAS/configuration.py b/DAS/configuration.py index a2e614e..d3647a4 100644 --- a/DAS/configuration.py +++ b/DAS/configuration.py @@ -4,7 +4,6 @@ import configparser class Configuration: - deterministic = 0 def __init__(self, fileName): diff --git a/DAS/observer.py b/DAS/observer.py index ad9052b..515fe09 100644 --- a/DAS/observer.py +++ b/DAS/observer.py @@ -4,18 +4,16 @@ from DAS.block import * class Observer: - block = [] - rows = [] - columns = [] - goldenData = [] - broadcasted = [] - config = [] - logger = [] - def __init__(self, logger, config): self.config = config self.format = {"entity": "Observer"} self.logger = logger + self.block = [] + self.rows = [] + self.columns = [] + self.goldenData = [] + self.broadcasted = [] + def reset(self): self.block = [0] * self.config.blockSize * self.config.blockSize diff --git a/DAS/results.py b/DAS/results.py index 48b6cbc..174e5e9 100644 --- a/DAS/results.py +++ b/DAS/results.py @@ -6,10 +6,6 @@ from dicttoxml import dicttoxml class Result: - shape = [] - missingVector = [] - blockAvailable = -1 - tta = -1 def __init__(self, shape): self.shape = shape diff --git a/DAS/shape.py b/DAS/shape.py index 243ae8e..84efc1e 100644 --- a/DAS/shape.py +++ b/DAS/shape.py @@ -1,12 +1,6 @@ #!/bin/python3 class Shape: - run = 0 - numberValidators = 0 - blockSize = 0 - failureRate = 0 - netDegree = 0 - chi = 0 def __init__(self, blockSize, numberValidators, failureRate, chi, netDegree, run): self.run = run diff --git a/DAS/simulator.py b/DAS/simulator.py index cba63c8..cc02a6b 100644 --- a/DAS/simulator.py +++ b/DAS/simulator.py @@ -10,19 +10,16 @@ from DAS.validator import * class Simulator: - proposerID = 0 - logLevel = logging.INFO - validators = [] - glob = [] - result = [] - shape = [] - logger = [] - format = {} def __init__(self, shape): self.shape = shape self.format = {"entity": "Simulator"} self.result = Result(self.shape) + self.validators = [] + self.logger = [] + self.logLevel = logging.INFO + self.proposerID = 0 + self.glob = [] def initValidators(self): self.glob = Observer(self.logger, self.shape) diff --git a/DAS/validator.py b/DAS/validator.py index 950fdea..491f3da 100644 --- a/DAS/validator.py +++ b/DAS/validator.py @@ -20,11 +20,6 @@ class Neighbor: class Validator: - ID = 0 - amIproposer = 0 - shape = [] - format = {} - logger = [] def __repr__(self): return str(self.ID) diff --git a/config.das b/config.ini similarity index 100% rename from config.das rename to config.ini