From eec0d899dc2488c5f7fb69281e308ab1b95f5e73 Mon Sep 17 00:00:00 2001 From: Swann Date: Tue, 23 Jul 2019 11:41:36 +0200 Subject: [PATCH] feat: repr --- replication.py | 4 ++-- replication_graph.py | 6 ++++++ test_replication.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/replication.py b/replication.py index ddfe7c0..9a9e97d 100644 --- a/replication.py +++ b/replication.py @@ -183,10 +183,10 @@ class ReplicatedDatablock(object): raise NotImplementedError def __repr__(self): - return "{uuid} - Owner: {owner} - ETA: {state} ".format( + return "{uuid} - owner: {owner} - type: {type}".format( uuid=self.uuid, owner=self.owner, - state=self.state + type=self.str_type ) class RepCommand(ReplicatedDatablock): diff --git a/replication_graph.py b/replication_graph.py index 0bf233a..014b12c 100644 --- a/replication_graph.py +++ b/replication_graph.py @@ -25,6 +25,12 @@ class ReplicationGraph(collections.MutableMapping): def __len__(self): return len(self.store) + def __repr__(self): + str = "\n" + for key,item in self.store.items(): + str+=repr(item) + return str + \ No newline at end of file diff --git a/test_replication.py b/test_replication.py index 1370672..4cd416b 100644 --- a/test_replication.py +++ b/test_replication.py @@ -8,7 +8,7 @@ import cProfile import re -log = logging.getLogger(__name__) +logger = logging.getLogger(__name__) class SampleData(): def __init__(self, map={"sample":"data"}): @@ -189,7 +189,7 @@ class TestClient(unittest.TestCase): client.unregister(data_sample_key) - + logger.debug(client._rep_store) client.disconnect() client2.disconnect() server.stop()