Skip to content

Commit 3c8e931

Browse files
cclaussAnshulMalik
authored andcommitted
Travis CI: Add a flake8 test for unused imports (TheAlgorithms#1038)
1 parent 46bcee0 commit 3c8e931

File tree

5 files changed

+212
-221
lines changed

5 files changed

+212
-221
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ before_install: pip install --upgrade pip setuptools
66
install: pip install -r requirements.txt
77
before_script:
88
- black --check . || true
9-
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
9+
- flake8 . --count --select=E9,F401,F63,F7,F82 --show-source --statistics
1010
script:
1111
- mypy --ignore-missing-imports .
1212
- pytest . --doctest-modules

graphs/bfs.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,19 @@
1616
1717
"""
1818

19-
import collections
19+
G = {'A': ['B', 'C'],
20+
'B': ['A', 'D', 'E'],
21+
'C': ['A', 'F'],
22+
'D': ['B'],
23+
'E': ['B', 'F'],
24+
'F': ['C', 'E']}
2025

2126

2227
def bfs(graph, start):
28+
"""
29+
>>> ''.join(sorted(bfs(G, 'A')))
30+
'ABCDEF'
31+
"""
2332
explored, queue = set(), [start] # collections.deque([start])
2433
explored.add(start)
2534
while queue:
@@ -31,11 +40,5 @@ def bfs(graph, start):
3140
return explored
3241

3342

34-
G = {'A': ['B', 'C'],
35-
'B': ['A', 'D', 'E'],
36-
'C': ['A', 'F'],
37-
'D': ['B'],
38-
'E': ['B', 'F'],
39-
'F': ['C', 'E']}
40-
41-
print(bfs(G, 'A'))
43+
if __name__ == '__main__':
44+
print(bfs(G, 'A'))

maths/volume.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
from math import pi
88

9-
PI = pi
10-
119

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

42-
import math
43-
44-
return (float(1) / 3) * PI * (radius ** 2) * height
40+
return (float(1) / 3) * pi * (radius ** 2) * height
4541

4642

4743
def vol_prism(area_of_base, height):
@@ -71,7 +67,7 @@ def vol_sphere(radius):
7167
V = (4/3) * pi * r^3
7268
Wikipedia reference: https://en.wikipedia.org/wiki/Sphere
7369
"""
74-
return (float(4) / 3) * PI * radius ** 3
70+
return (float(4) / 3) * pi * radius ** 3
7571

7672

7773
def vol_circular_cylinder(radius, height):
@@ -80,7 +76,7 @@ def vol_circular_cylinder(radius, height):
8076
Wikipedia reference: https://en.wikipedia.org/wiki/Cylinder
8177
volume = pi * radius^2 * height
8278
"""
83-
return PI * radius ** 2 * height
79+
return pi * radius ** 2 * height
8480

8581

8682
def main():

0 commit comments

Comments
 (0)