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

Py3 #53

Merged
merged 5 commits into from
Oct 20, 2015
Merged

Py3 #53

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
@@ -1,7 +1,7 @@
language: python
python:
- "2.7"
#- "3.5"
- "3.4"
cache:
directories:
- $HOME/.wheelhouse/
Expand Down
4 changes: 3 additions & 1 deletion panoramix/bin/panoramix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import csv
from datetime import datetime
import gzip
import json
import os
from subprocess import Popen

from flask.ext.script import Manager
Expand Down Expand Up @@ -79,7 +80,8 @@ def load_examples(sample):

BirthNames.create(db.engine)
session = db.session()
with gzip.open(config.get("BASE_DIR") + '/data/birth_names.csv.gz') as f:
filepath = os.path.join(config.get("BASE_DIR"), 'data/birth_names.csv.gz')
with gzip.open(filepath, mode='rt') as f:
bb_csv = csv.reader(f)
for i, (state, year, name, gender, num) in enumerate(bb_csv):
if i == 0 or year < "1965": # jumpy data before 1965
Expand Down
3 changes: 2 additions & 1 deletion panoramix/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from wtforms import validators
from copy import copy
from panoramix import app
from six import string_types
config = app.config


Expand Down Expand Up @@ -240,7 +241,7 @@ class QueryForm(OmgWtForm):
QueryForm, 'flt_eq_' + str(i),
TextField("Super", default=''))
for ff in viz.form_fields:
if isinstance(ff, basestring):
if isinstance(ff, string_types):
ff = [ff]
for s in ff:
if s:
Expand Down
5 changes: 3 additions & 2 deletions panoramix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import requests
import textwrap

from six import string_types

from panoramix import app, db, get_session, utils
from panoramix.viz import viz_types
from sqlalchemy.ext.declarative import declared_attr
Expand Down Expand Up @@ -458,7 +460,6 @@ def query(

engine = self.database.get_sqla_engine()
sql = str(qry.compile(engine, compile_kwargs={"literal_binds": True}))
print sql
df = read_sql_query(
sql=sql,
con=engine
Expand Down Expand Up @@ -767,7 +768,7 @@ def query(
if granularity != "all":
granularity = utils.parse_human_timedelta(
granularity).total_seconds() * 1000
if not isinstance(granularity, basestring):
if not isinstance(granularity, string_types):
granularity = {"type": "duration", "duration": granularity}

qry = dict(
Expand Down
1 change: 1 addition & 0 deletions panoramix/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def color(s):
"#A14D83", "#4FA3AB", "#4EDED2", "#4EDED2", "#FFCA4F", "#FFC4B3",
"#C9BF97", "#C9BF97", "#898C8C",
]
s = s.encode('utf-8')
h = hashlib.md5(s)
i = int(h.hexdigest(), 16)
return colors[i % len(colors)]
Expand Down
6 changes: 4 additions & 2 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from panoramix import app, utils
from panoramix.forms import FormFactory

from six import string_types

config = app.config


Expand Down Expand Up @@ -468,7 +470,7 @@ def to_series(self, df, classed='', title_suffix=''):
if df[name].dtype.kind not in "biufc":
continue
df['timestamp'] = pd.to_datetime(df.index, utc=False)
if isinstance(name, basestring):
if isinstance(name, string_types):
series_title = name
else:
name = ["{}".format(s) for s in name]
Expand Down Expand Up @@ -622,7 +624,7 @@ def get_json_data(self):
if df[name].dtype.kind not in "biufc":
continue
df['timestamp'] = pd.to_datetime(df.index, utc=False)
if isinstance(name, basestring):
if isinstance(name, string_types):
series_title = name
elif len(self.metrics) > 1:
series_title = ", ".join(name)
Expand Down
12 changes: 9 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
alembic>=0.7.7, <0.8.0
flask>=0.10.1, <1.0.0
coverage
coveralls
flask==0.10.1
flask-appbuilder>=1.4.5, <2.0.0
flask-login==0.2.11
flask-migrate>=1.5.1, <2.0.0
flask-script>=2.0.5, <3.0.0
flask-testing>=0.4.2, <0.5.0
gunicorn>=19.3.0, <20.0.0
markdown>=2.6.2, <3.0.0
numpy>=1.10, <2
pandas==0.16.2, <0.17
nose
numpy>=1.9
pandas==0.16.2
parsedatetime>=1.5, <2.0.0
pydruid>=0.2.2, <0.3
python-dateutil>=2.4.2, <3.0.0
requests>=2.7.0, <3.0.0
sqlparse>=0.1.16, <0.2.0
pyhive
pymysql
six
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'flask-testing>=0.4.2, <0.5.0',
'gunicorn>=19.3.0, <20.0.0',
'markdown>=2.6.2, <3.0.0',
'numpy>=1.10, <2',
'numpy>=1.9, <2',
'pandas==0.16.2, <0.17',
'parsedatetime>=1.5, <2.0.0',
'pydruid>=0.2.2, <0.3',
Expand Down
1 change: 0 additions & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import imp
import os
import unittest
import urllib2
os.environ['PANORAMIX_CONFIG'] = 'tests.panoramix_test_config'
from flask.ext.testing import LiveServerTestCase, TestCase

Expand Down