Skip to content

Travis CI: Add a flake8 test for unused imports #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 .
#- IGNORE="data_structures,file_transfer_protocol,graphs,machine_learning,maths,neural_network,project_euler"
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