From cb1a23e1d501d3d1b1be7a7b6c3ac6363102580e Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:29:44 -0300 Subject: [PATCH 1/7] Changing print sintax to Python3 It makes sense, since Python2 is now deprecated. See: https://www.python.org/doc/sunset-python-2/ --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 420a86a..40005b5 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,14 @@ s = # Parse the traceroute output traceroute = trparse.loads(s) # You can print the result -print traceroute +print(traceroute) # Save it as string tr_str = str(traceroute) # Or travel the tree hop = traceroute.hops[0] probe = hop.probes[0] # And print the IP address -print probe.ip +print(probe.ip) ``` # Data structures From ebd43f85cba409d0a97c12b0d0799ae04360b3e7 Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:32:51 -0300 Subject: [PATCH 2/7] Format header string using `format` Just to follow the pattern used in the project (there are lot's of other lines using `format`). --- trparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trparse.py b/trparse.py index 5eb380b..62da8f3 100644 --- a/trparse.py +++ b/trparse.py @@ -36,7 +36,7 @@ def add_hop(self, hop): self.hops.append(hop) def __str__(self): - text = "Traceroute for %s (%s)\n\n" % (self.dest_name, self.dest_ip) + text = "Traceroute for {} ({})\n\n".format(self.dest_name, self.dest_ip) for hop in self.hops: text += str(hop) return text From 07be3ffafe7f77554933bfdac3de7037b744c9a1 Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:53:20 -0300 Subject: [PATCH 3/7] Minor edit in README to improve consistency --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 40005b5..4c0130e 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ some tokens it expects to find in a specific format. For example: preceded by space characters). - **[AS\#]** must be surrounded by square brackets `[]` and start with `AS`. -- **Hostname** Can be a hostname or its IP address without parenthesis +- **Hostname** can be a hostname or its IP address without parenthesis. - **(IP address)** either IPv4 or IPv6 must surrounded by parenthesis `()`. - **RTT** must be in integer (without commas or dots) or float format From 85d1b97b44ba6858543578c8bed0ccf59dce6ca9 Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:54:38 -0300 Subject: [PATCH 4/7] Add syntax highlight in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4c0130e..6f85674 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ Supports the following info. Parsed info in bold: # Usage -``` +```python import trparse -s = +s = "" # Parse the traceroute output traceroute = trparse.loads(s) # You can print the result From b4bb885d8ab63a539205c099a4360a9ca956cb4b Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:56:16 -0300 Subject: [PATCH 5/7] Update `idx` comment to reflect `traceroute -f` output A traceroute output can start from a hop number different from 1 (this happens when using `traceroute -f FIRST_TTL`). --- trparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trparse.py b/trparse.py index 62da8f3..5e88d7e 100644 --- a/trparse.py +++ b/trparse.py @@ -47,7 +47,7 @@ class Hop(object): Abstraction of a hop in a traceroute. """ def __init__(self, idx): - self.idx = idx # Hop count, starting at 1 + self.idx = idx # Hop count, starting at 1 (usually) self.probes = [] # Series of Probe instances def add_probe(self, probe): From b7f16e6cfb0a66fb147f1828e1352402442fe001 Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:58:56 -0300 Subject: [PATCH 6/7] Update README moving ASN to probe To be consistent with changes in v0.3.0. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6f85674..eb4f383 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ Supports the following info. Parsed info in bold: - Hop - **Hop counter** - - **[AS\#]** - Probe + - **[AS\#]** - **Hostname** - **(IP address)** - **RTT** From b6d2776585c610d1c4de6f848463507572fa2908 Mon Sep 17 00:00:00 2001 From: Rarylson Freitas Date: Sun, 8 Mar 2020 11:59:51 -0300 Subject: [PATCH 7/7] Bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2950670..43b75f1 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ ] setup(name='trparse', - version='0.3.0', + version='0.3.1', description='Traceroute parser', author='Luis Benitez', url='https://github.com/lbenitez000/trparse',