Skip to content
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

Linting to 99% #317

Merged
merged 1 commit into from
Apr 11, 2016
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
3 changes: 0 additions & 3 deletions caravel/migrations/versions/d2424a248d63_.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
revision = 'd2424a248d63'
down_revision = ('a2d606a761d9', '836c0bf75904')

from alembic import op
import sqlalchemy as sa


def upgrade():
pass
Expand Down
3 changes: 0 additions & 3 deletions caravel/migrations/versions/fee7b758c130_.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
revision = 'fee7b758c130'
down_revision = ('1d2ddd543133', '763d4b211ec9')

from alembic import op
import sqlalchemy as sa


def upgrade():
pass
Expand Down
6 changes: 3 additions & 3 deletions caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ class AuditMixinNullable(AuditMixin):
onupdate=datetime.now, nullable=True)

@declared_attr
def created_by_fk(cls):
def created_by_fk(cls): # noqa
return Column(Integer, ForeignKey('ab_user.id'),
default=cls.get_user_id, nullable=True)

@declared_attr
def changed_by_fk(cls):
def changed_by_fk(cls): # noqa
return Column(
Integer, ForeignKey('ab_user.id'),
default=cls.get_user_id, onupdate=cls.get_user_id, nullable=True)

@property
def created_by_(self):
def created_by_(self): # noqa
return '{}'.format(self.created_by or '')

@property # noqa
Expand Down
4 changes: 2 additions & 2 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def explore(self, datasource_type, datasource_id):
obj = viz.viz_types[viz_type](
datasource,
form_data=request.args,
slice=slc)
slice_=slc)
if request.args.get("json") == "true":
status = 200
try:
Expand Down Expand Up @@ -642,7 +642,7 @@ def testconn(self):
@expose("/favstar/<class_name>/<obj_id>/<action>/")
def favstar(self, class_name, obj_id, action):
session = db.session()
FavStar = models.FavStar
FavStar = models.FavStar # noqa
count = 0
favs = session.query(FavStar).filter_by(
class_name=class_name, obj_id=obj_id, user_id=g.user.id).all()
Expand Down
6 changes: 4 additions & 2 deletions caravel/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ class BaseViz(object):
},)
form_overrides = {}

def __init__(self, datasource, form_data, slice=None):
def __init__(self, datasource, form_data, slice_=None):
self.orig_form_data = form_data
if not datasource:
raise Exception("Viz is missing a datasource")
self.datasource = datasource
self.request = request
self.viz_type = form_data.get("viz_type")
self.slice = slice
self.slice = slice_

# TODO refactor all form related logic out of here and into forms.py
ff = FormFactory(self)
Expand Down Expand Up @@ -1062,12 +1062,14 @@ def get_data(self):
def find_cycle(g):
"""Whether there's a cycle in a directed graph"""
path = set()

def visit(vertex):
path.add(vertex)
for neighbour in g.get(vertex, ()):
if neighbour in path or visit(neighbour):
return (vertex, neighbour)
path.remove(vertex)

for v in g:
cycle = visit(v)
if cycle:
Expand Down