Skip to content

Commit

Permalink
Linting to 99% (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Apr 11, 2016
1 parent c6da811 commit 5b82249
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
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 @@ -46,14 +46,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 @@ -1170,12 +1170,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

0 comments on commit 5b82249

Please sign in to comment.