-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from thombashi/develop
Develop
- Loading branch information
Showing
14 changed files
with
707 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
""" | ||
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> | ||
""" | ||
|
||
from __future__ import print_function | ||
import json | ||
|
||
|
||
def print_ping_parser(ping_parser): | ||
print("# properties ---") | ||
print("packet_transmit: {:d} packets".format(ping_parser.packet_transmit)) | ||
print("packet_receive: {:d} packets".format(ping_parser.packet_receive)) | ||
print("packet_loss: {:.1f} %".format(ping_parser.packet_loss)) | ||
print("rtt_min:", ping_parser.rtt_min) | ||
print("rtt_avg:", ping_parser.rtt_avg) | ||
print("rtt_max:", ping_parser.rtt_max) | ||
print("rtt_mdev:", ping_parser.rtt_mdev) | ||
print() | ||
print("# asdict ---") | ||
print(json.dumps(ping_parser.as_dict(), indent=4)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
""" | ||
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> | ||
""" | ||
|
||
from __future__ import print_function | ||
import argparse | ||
import sys | ||
|
||
import examplecommon | ||
import pingparsing | ||
|
||
|
||
def parse_option(): | ||
parser = argparse.ArgumentParser() | ||
parser .add_argument( | ||
"-f", "--file", required=True, help="input file path") | ||
|
||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
options = parse_option() | ||
|
||
ping_parser = pingparsing.PingParsing() | ||
with open(options.file) as f: | ||
ping_parser.parse(f.read()) | ||
|
||
examplecommon.print_ping_parser(ping_parser) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
Oops, something went wrong.