Skip to content

Commit

Permalink
Travis CI: Add a flake8 test for unused imports (TheAlgorithms#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss authored and AnshulMalik committed Jul 25, 2019
1 parent 46bcee0 commit 3c8e931
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ before_install: pip install --upgrade pip setuptools
install: pip install -r requirements.txt
before_script:
- black --check . || true
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- flake8 . --count --select=E9,F401,F63,F7,F82 --show-source --statistics
script:
- mypy --ignore-missing-imports .
- pytest . --doctest-modules
Expand Down
21 changes: 12 additions & 9 deletions graphs/bfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,19 @@
"""

import collections
G = {'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F'],
'D': ['B'],
'E': ['B', 'F'],
'F': ['C', 'E']}


def bfs(graph, start):
"""
>>> ''.join(sorted(bfs(G, 'A')))
'ABCDEF'
"""
explored, queue = set(), [start] # collections.deque([start])
explored.add(start)
while queue:
Expand All @@ -31,11 +40,5 @@ def bfs(graph, start):
return explored


G = {'A': ['B', 'C'],
'B': ['A', 'D', 'E'],
'C': ['A', 'F'],
'D': ['B'],
'E': ['B', 'F'],
'F': ['C', 'E']}

print(bfs(G, 'A'))
if __name__ == '__main__':
print(bfs(G, 'A'))
10 changes: 3 additions & 7 deletions maths/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

from math import pi

PI = pi


def vol_cube(side_length):
"""Calculate the Volume of a Cube."""
Expand Down Expand Up @@ -39,9 +37,7 @@ def vol_right_circ_cone(radius, height):
volume = (1/3) * pi * radius^2 * height
"""

import math

return (float(1) / 3) * PI * (radius ** 2) * height
return (float(1) / 3) * pi * (radius ** 2) * height


def vol_prism(area_of_base, height):
Expand Down Expand Up @@ -71,7 +67,7 @@ def vol_sphere(radius):
V = (4/3) * pi * r^3
Wikipedia reference: https://en.wikipedia.org/wiki/Sphere
"""
return (float(4) / 3) * PI * radius ** 3
return (float(4) / 3) * pi * radius ** 3


def vol_circular_cylinder(radius, height):
Expand All @@ -80,7 +76,7 @@ def vol_circular_cylinder(radius, height):
Wikipedia reference: https://en.wikipedia.org/wiki/Cylinder
volume = pi * radius^2 * height
"""
return PI * radius ** 2 * height
return pi * radius ** 2 * height


def main():
Expand Down
Loading

0 comments on commit 3c8e931

Please sign in to comment.