Skip to content

Commit

Permalink
feat: Add stats properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Maggio committed Aug 19, 2022
1 parent 2112eb5 commit 44e76d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pythonping/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 44e76d4

Please sign in to comment.