Skip to content

Commit

Permalink
Resolve remaining issues spotted by flake8
Browse files Browse the repository at this point in the history
- C901 'main' is too complex (18)
- E501 line too long (83 > 79 characters)
- F401 '.aggregate6.aggregate' imported but unused
  • Loading branch information
robert-scheck committed Nov 17, 2024
1 parent cf09195 commit ebf5c1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ jobs:
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# For now, treat all errors as warnings using --exit-zero
flake8 . --count --exit-zero --max-complexity=10 --statistics
# For now, ignore F401 ('.aggregate6.aggregate' imported but unused)
# as, when removing the import, it at least breaks pytest, accept the
# max. complexity of 18 for main() - and just fail otherwise
flake8 . --count --ignore=F401 --max-complexity=18 --statistics
- name: Set $PYTHONPATH
run: echo "PYTHONPATH=$RUNNER_WORKSPACE/aggregate6" >> $GITHUB_ENV
- name: Test with pytest
Expand Down
3 changes: 2 additions & 1 deletion aggregate6/aggregate6.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def _aggregate_phase2(tree):
for rnode in tree:
p = text(ip_network(text(rnode.prefix)).supernet())
r = tree.search_covered(p)
if len(r) == 2 and r[0].prefixlen == r[1].prefixlen == rnode.prefixlen:
if len(r) == 2 \
and r[0].prefixlen == r[1].prefixlen == rnode.prefixlen:
n_tree.add(p)
aggregations += 1
else:
Expand Down

0 comments on commit ebf5c1b

Please sign in to comment.