Skip to content

Commit cf09195

Browse files
authored
Merge pull request #20 from movatica/fix-flake8-errors
Fix some flake8 linting errors
2 parents e3f965f + 663df82 commit cf09195

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

aggregate6/aggregate6.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
try:
3232
from builtins import str as text
33-
except:
33+
except ImportError:
3434
# Python2.7 compatibility
3535
from __builtin__ import unicode as text
3636

@@ -41,21 +41,21 @@
4141
import sys
4242

4343

44-
def aggregate(l):
44+
def aggregate(prefixes):
4545
"""Aggregate a `list` of prefixes.
4646
4747
Keyword arguments:
48-
l -- a python list of prefixes
48+
prefixes -- a python list of prefixes
4949
5050
Example use:
5151
>>> aggregate(["10.0.0.0/8", "10.0.0.0/24"])
5252
['10.0.0.0/8']
5353
"""
5454
tree = radix.Radix()
55-
for item in l:
55+
for item in prefixes:
5656
try:
5757
tree.add(item)
58-
except (ValueError) as err:
58+
except ValueError:
5959
raise Exception("ERROR: invalid IP prefix: {}".format(item))
6060

6161
return aggregate_tree(tree).prefixes()
@@ -155,7 +155,7 @@ def main():
155155
else:
156156
prefix_obj = ip_network(text(elem.strip()))
157157
prefix = text(prefix_obj)
158-
except (ValueError) as err:
158+
except ValueError:
159159
sys.stderr.write("ERROR: '%s' is not a valid IP network, \
160160
ignoring.\n" % elem.strip())
161161
continue

0 commit comments

Comments
 (0)