From 44e76d4b0e5489442d7b03020472d7bbe676ea92 Mon Sep 17 00:00:00 2001 From: Alessandro Maggio Date: Fri, 19 Aug 2022 15:11:42 +0200 Subject: [PATCH] feat: Add stats properties --- pythonping/executor.py | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pythonping/executor.py b/pythonping/executor.py index 8498bc5..58bdcf3 100644 --- a/pythonping/executor.py +++ b/pythonping/executor.py @@ -235,14 +235,19 @@ def append(self, value): if self.verbose: print(value, file=self.output) + @property def stats_packets_lost(self): return self.stats_packets_sent - self.stats_packets_returned + @property def stats_success_ratio(self): return self.stats_packets_returned / self.stats_packets_sent + @property def stats_lost_ratio(self): return 1 - self.stats_success_ratio + @property def packets_lost(self): return self.stats_lost_ratio + def __len__(self): return len(self._responses) diff --git a/setup.py b/setup.py index 977cd45..e460001 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ long_description = file.read() setup(name='pythonping', - version='1.1.2', + version='1.1.3', description='A simple way to ping in Python', url='https://github.com/alessandromaggio/pythonping', author='Alessandro Maggio',