Skip to content

Commit

Permalink
Miscellaneous style fixes spotted by landscape (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx authored and mistercrunch committed Aug 4, 2016
1 parent 82a8e63 commit 7c810db
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
6 changes: 3 additions & 3 deletions caravel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
app = Flask(__name__)
app.config.from_object(CONFIG_MODULE)
if not app.debug:
# In production mode, add log handler to sys.stderr.
app.logger.addHandler(logging.StreamHandler())
app.logger.setLevel(logging.INFO)
# In production mode, add log handler to sys.stderr.
app.logger.addHandler(logging.StreamHandler())
app.logger.setLevel(logging.INFO)

db = SQLA(app)

Expand Down
2 changes: 1 addition & 1 deletion caravel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/caravel.db'
# this is for platform specific: "nt" is for windows, "posix" is *nix (including Mac)
if os.name == "nt":
SQLALCHEMY_DATABASE_URI = 'sqlite:///c:\\tmp\\caravel.db'
SQLALCHEMY_DATABASE_URI = 'sqlite:///c:\\tmp\\caravel.db'
# SQLALCHEMY_DATABASE_URI = 'mysql://myapp@localhost/myapp'
# SQLALCHEMY_DATABASE_URI = 'postgresql://root:password@localhost/myapp'

Expand Down
2 changes: 1 addition & 1 deletion caravel/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def __init__(self, viz):
"description": _("Columns to display")
}),
'druid_time_origin': (FreeFormSelectField, {
"label": _( "Origin"),
"label": _("Origin"),
"choices": (
('', _('default')),
('now', _('now')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
down_revision = '956a063c52b3'

from alembic import op
from caravel import db, models
from caravel import db
from caravel.utils import generic_find_constraint_name
import logging

Expand Down
10 changes: 4 additions & 6 deletions caravel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ def explore_url(self):
return "/caravel/explore/{obj.type}/{obj.id}/".format(obj=self)



class Database(Model, AuditMixinNullable):

"""An ORM object that stores Database related information"""
Expand Down Expand Up @@ -536,7 +535,6 @@ class SqlaTable(Model, Queryable, AuditMixinNullable):
'database_id', 'schema', 'table_name',
name='_customer_location_uc'),)


def __repr__(self):
return self.table_name

Expand Down Expand Up @@ -743,7 +741,7 @@ def query( # sqla
qry = qry.limit(row_limit)

if timeseries_limit and groupby:
# some sql dialects require for order by expressions
# some sql dialects require for order by expressions
# to also be in the select clause
inner_select_exprs += [main_metric_expr]
subq = select(inner_select_exprs)
Expand All @@ -765,7 +763,7 @@ def query( # sqla
sql = "{}".format(
qry.compile(
engine, compile_kwargs={"literal_binds": True},),
)
)
df = pd.read_sql_query(
sql=sql,
con=engine
Expand Down Expand Up @@ -1125,7 +1123,7 @@ def version_higher(v1, v2):
def int_or_0(v):
try:
v = int(v)
except Exception as e:
except (TypeError, ValueError):
v = 0
return v
v1nums = [int_or_0(n) for n in v1.split('.')]
Expand Down Expand Up @@ -1282,7 +1280,7 @@ def recursive_get_fields(_conf):
if rejected_metrics:
raise MetricPermException(
"Access to the metrics denied: " + ', '.join(rejected_metrics)
)
)

granularity = granularity or "all"
if granularity != "all":
Expand Down
5 changes: 2 additions & 3 deletions caravel/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import json
import logging
import numpy
import time

import parsedatetime
import sqlalchemy as sa
Expand Down Expand Up @@ -300,7 +299,7 @@ def json_iso_dttm_ser(obj):
obj = obj.isoformat()
else:
raise TypeError(
"Unserializable object {} of type {}".format(obj, type(obj))
"Unserializable object {} of type {}".format(obj, type(obj))
)
return obj

Expand All @@ -314,7 +313,7 @@ def json_int_dttm_ser(obj):
obj = (obj - EPOCH).total_seconds() * 1000
else:
raise TypeError(
"Unserializable object {} of type {}".format(obj, type(obj))
"Unserializable object {} of type {}".format(obj, type(obj))
)
return obj

Expand Down
1 change: 0 additions & 1 deletion caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,6 @@ def sql_json(self):
}
return json.dumps(data, default=utils.json_int_dttm_ser, allow_nan=False)


@has_access
@expose("/refresh_datasources/")
def refresh_datasources(self):
Expand Down

0 comments on commit 7c810db

Please sign in to comment.