remove six dependency (#6091)
This commit is contained in:
parent
e1e8778554
commit
047c8b0943
|
|
@ -75,7 +75,6 @@ rfc3986==1.1.0 # via tableschema
|
|||
s3transfer==0.1.13 # via boto3
|
||||
sasl==0.2.1 # via thrift-sasl
|
||||
simplejson==3.15.0
|
||||
six==1.11.0
|
||||
sqlalchemy-utils==0.32.21
|
||||
sqlalchemy==1.2.2
|
||||
sqlparse==0.2.4
|
||||
|
|
|
|||
1
setup.py
1
setup.py
|
|
@ -91,7 +91,6 @@ setup(
|
|||
'pyyaml>=3.11',
|
||||
'requests',
|
||||
'simplejson>=3.15.0',
|
||||
'six',
|
||||
'sqlalchemy',
|
||||
'sqlalchemy-utils',
|
||||
'sqlparse',
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ from pydruid.utils.postaggregator import (
|
|||
Const, Field, HyperUniqueCardinality, Postaggregator, Quantile, Quantiles,
|
||||
)
|
||||
import requests
|
||||
from six import string_types
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import (
|
||||
Boolean, Column, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint,
|
||||
|
|
@ -775,7 +774,7 @@ class DruidDatasource(Model, BaseDatasource):
|
|||
if period_name in ('week_ending_saturday', 'week_starting_sunday'):
|
||||
# use Sunday as start of the week
|
||||
granularity['origin'] = '2016-01-03T00:00:00'
|
||||
elif not isinstance(period_name, string_types):
|
||||
elif not isinstance(period_name, str):
|
||||
granularity['type'] = 'duration'
|
||||
granularity['duration'] = period_name
|
||||
elif period_name.startswith('P'):
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ from flask_appbuilder.security.sqla.models import User
|
|||
from future.standard_library import install_aliases
|
||||
import numpy
|
||||
import pandas as pd
|
||||
import six
|
||||
import sqlalchemy as sqla
|
||||
from sqlalchemy import (
|
||||
Boolean, Column, create_engine, DateTime, ForeignKey, Integer,
|
||||
|
|
@ -777,7 +776,7 @@ class Database(Model, AuditMixinNullable, ImportMixin):
|
|||
return self.get_dialect().identifier_preparer.quote
|
||||
|
||||
def get_df(self, sql, schema):
|
||||
sqls = [six.text_type(s).strip().strip(';') for s in sqlparse.parse(sql)]
|
||||
sqls = [str(s).strip().strip(';') for s in sqlparse.parse(sql)]
|
||||
engine = self.get_sqla_engine(schema=schema)
|
||||
|
||||
def needs_conversion(df_series):
|
||||
|
|
@ -814,7 +813,7 @@ class Database(Model, AuditMixinNullable, ImportMixin):
|
|||
def compile_sqla_query(self, qry, schema=None):
|
||||
engine = self.get_sqla_engine(schema=schema)
|
||||
|
||||
sql = six.text_type(
|
||||
sql = str(
|
||||
qry.compile(
|
||||
engine,
|
||||
compile_kwargs={'literal_binds': True},
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import os
|
|||
import re
|
||||
import time
|
||||
import traceback
|
||||
from urllib import parse
|
||||
|
||||
from flask import (
|
||||
flash, g, Markup, redirect, render_template, request, Response, url_for,
|
||||
|
|
@ -24,8 +25,6 @@ from flask_babel import gettext as __
|
|||
from flask_babel import lazy_gettext as _
|
||||
import pandas as pd
|
||||
import simplejson as json
|
||||
from six import text_type
|
||||
from six.moves.urllib import parse
|
||||
import sqlalchemy as sqla
|
||||
from sqlalchemy import and_, create_engine, MetaData, or_, update
|
||||
from sqlalchemy.engine.url import make_url
|
||||
|
|
@ -373,7 +372,7 @@ class CsvToDatabaseView(SimpleFormView):
|
|||
except OSError:
|
||||
pass
|
||||
message = 'Table name {} already exists. Please pick another'.format(
|
||||
form.name.data) if isinstance(e, IntegrityError) else text_type(e)
|
||||
form.name.data) if isinstance(e, IntegrityError) else e
|
||||
flash(
|
||||
message,
|
||||
'danger')
|
||||
|
|
|
|||
|
|
@ -13,11 +13,13 @@ from __future__ import unicode_literals
|
|||
from collections import defaultdict, OrderedDict
|
||||
import copy
|
||||
from datetime import datetime, timedelta
|
||||
from functools import reduce
|
||||
import hashlib
|
||||
import inspect
|
||||
from itertools import product
|
||||
import logging
|
||||
import math
|
||||
import pickle as pkl
|
||||
import re
|
||||
import traceback
|
||||
import uuid
|
||||
|
|
@ -34,8 +36,6 @@ from pandas.tseries.frequencies import to_offset
|
|||
from past.builtins import basestring
|
||||
import polyline
|
||||
import simplejson as json
|
||||
from six import string_types, text_type
|
||||
from six.moves import cPickle as pkl, reduce
|
||||
|
||||
from superset import app, cache, get_css_manifest_files, utils
|
||||
from superset.exceptions import NullValueException, SpatialException
|
||||
|
|
@ -120,7 +120,7 @@ class BaseViz(object):
|
|||
self.metric_labels = list(self.metric_dict.keys())
|
||||
|
||||
def get_metric_label(self, metric):
|
||||
if isinstance(metric, string_types):
|
||||
if isinstance(metric, str):
|
||||
return metric
|
||||
|
||||
if isinstance(metric, dict):
|
||||
|
|
@ -139,7 +139,7 @@ class BaseViz(object):
|
|||
# if an int is too big for Java Script to handle
|
||||
# convert it to a string
|
||||
if abs(v) > JS_MAX_INTEGER:
|
||||
d[k] = text_type(v)
|
||||
d[k] = str(v)
|
||||
return data
|
||||
|
||||
def run_extra_queries(self):
|
||||
|
|
@ -789,7 +789,7 @@ class CalHeatmapViz(BaseViz):
|
|||
records = df.to_dict('records')
|
||||
for metric in self.metric_labels:
|
||||
data[metric] = {
|
||||
text_type(obj[DTTM_ALIAS].value / 10**9): obj.get(metric)
|
||||
str(obj[DTTM_ALIAS].value / 10**9): obj.get(metric)
|
||||
for obj in records
|
||||
}
|
||||
|
||||
|
|
@ -1089,11 +1089,11 @@ class NVD3TimeSeriesViz(NVD3Viz):
|
|||
if df[name].dtype.kind not in 'biufc':
|
||||
continue
|
||||
if isinstance(name, list):
|
||||
series_title = [text_type(title) for title in name]
|
||||
series_title = [str(title) for title in name]
|
||||
elif isinstance(name, tuple):
|
||||
series_title = tuple(text_type(title) for title in name)
|
||||
series_title = tuple(str(title) for title in name)
|
||||
else:
|
||||
series_title = text_type(name)
|
||||
series_title = str(name)
|
||||
if (
|
||||
isinstance(series_title, (list, tuple)) and
|
||||
len(series_title) > 1 and
|
||||
|
|
@ -1101,7 +1101,7 @@ class NVD3TimeSeriesViz(NVD3Viz):
|
|||
# Removing metric from series name if only one metric
|
||||
series_title = series_title[1:]
|
||||
if title_suffix:
|
||||
if isinstance(series_title, string_types):
|
||||
if isinstance(series_title, str):
|
||||
series_title = (series_title, title_suffix)
|
||||
elif isinstance(series_title, (list, tuple)):
|
||||
series_title = series_title + (title_suffix,)
|
||||
|
|
@ -1526,18 +1526,18 @@ class DistributionBarViz(DistributionPieViz):
|
|||
for name, ys in pt.items():
|
||||
if pt[name].dtype.kind not in 'biufc' or name in self.groupby:
|
||||
continue
|
||||
if isinstance(name, string_types):
|
||||
if isinstance(name, str):
|
||||
series_title = name
|
||||
else:
|
||||
offset = 0 if len(metrics) > 1 else 1
|
||||
series_title = ', '.join([text_type(s) for s in name[offset:]])
|
||||
series_title = ', '.join([str(s) for s in name[offset:]])
|
||||
values = []
|
||||
for i, v in ys.items():
|
||||
x = i
|
||||
if isinstance(x, (tuple, list)):
|
||||
x = ', '.join([text_type(s) for s in x])
|
||||
x = ', '.join([str(s) for s in x])
|
||||
else:
|
||||
x = text_type(x)
|
||||
x = str(x)
|
||||
values.append({
|
||||
'x': x,
|
||||
'y': v,
|
||||
|
|
@ -1753,7 +1753,7 @@ class WorldMapViz(BaseViz):
|
|||
d = df.to_dict(orient='records')
|
||||
for row in d:
|
||||
country = None
|
||||
if isinstance(row['country'], string_types):
|
||||
if isinstance(row['country'], str):
|
||||
country = countries.get(
|
||||
fd.get('country_fieldtype'), row['country'])
|
||||
|
||||
|
|
@ -2509,7 +2509,7 @@ class PairedTTestViz(BaseViz):
|
|||
series = df.to_dict('series')
|
||||
for nameSet in df.columns:
|
||||
# If no groups are defined, nameSet will be the metric name
|
||||
hasGroup = not isinstance(nameSet, string_types)
|
||||
hasGroup = not isinstance(nameSet, str)
|
||||
Y = series[nameSet]
|
||||
d = {
|
||||
'group': nameSet[1:] if hasGroup else 'All',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import unittest
|
|||
import mock
|
||||
import pandas as pd
|
||||
import psycopg2
|
||||
from six import text_type
|
||||
import sqlalchemy as sqla
|
||||
|
||||
from superset import dataframe, db, jinja_context, security_manager, sql_lab, utils
|
||||
|
|
@ -650,7 +649,7 @@ class CoreTests(SupersetTestCase):
|
|||
clean_query = "SELECT '/* val 1 */' as c1, '-- val 2' as c2 FROM tbl"
|
||||
commented_query = '/* comment 1 */' + clean_query + '-- comment 2'
|
||||
table = SqlaTable(sql=commented_query)
|
||||
rendered_query = text_type(table.get_from_clause())
|
||||
rendered_query = str(table.get_from_clause())
|
||||
self.assertEqual(clean_query, rendered_query)
|
||||
|
||||
def test_slice_payload_no_data(self):
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import inspect
|
||||
|
||||
from six import text_type
|
||||
|
||||
from superset import db_engine_specs
|
||||
from superset.db_engine_specs import (
|
||||
BaseEngineSpec, HiveEngineSpec, MssqlEngineSpec,
|
||||
|
|
@ -98,8 +96,7 @@ class DbEngineSpecsTestCase(SupersetTestCase):
|
|||
|
||||
e = Exception("Some string that doesn't match the regex")
|
||||
self.assertEquals(
|
||||
text_type(e),
|
||||
HiveEngineSpec.extract_error_message(e))
|
||||
str(e), HiveEngineSpec.extract_error_message(e))
|
||||
|
||||
msg = (
|
||||
'errorCode=10001, '
|
||||
|
|
|
|||
Loading…
Reference in New Issue