superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Improve code smell, use py3k super() call (#7100)
Date Fri, 12 Apr 2019 04:48:43 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 763db8f  Improve code smell, use py3k super() call (#7100)
763db8f is described below

commit 763db8fd76c201e0da5b74e33fc849a2f01523e8
Author: Yongjie Zhao <yongjie.zhao@gmail.com>
AuthorDate: Fri Apr 12 12:48:35 2019 +0800

    Improve code smell, use py3k super() call (#7100)
---
 superset/viz.py | 78 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/superset/viz.py b/superset/viz.py
index 786fad1..f9e64f9 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -516,7 +516,7 @@ class TableViz(BaseViz):
         return fd.get('include_time')
 
     def query_obj(self):
-        d = super(TableViz, self).query_obj()
+        d = super().query_obj()
         fd = self.form_data
 
         if fd.get('all_columns') and (fd.get('groupby') or fd.get('metrics')):
@@ -608,7 +608,7 @@ class TimeTableViz(BaseViz):
     is_timeseries = True
 
     def query_obj(self):
-        d = super(TimeTableViz, self).query_obj()
+        d = super().query_obj()
         fd = self.form_data
 
         if not fd.get('metrics'):
@@ -651,7 +651,7 @@ class PivotTableViz(BaseViz):
     is_timeseries = False
 
     def query_obj(self):
-        d = super(PivotTableViz, self).query_obj()
+        d = super().query_obj()
         groupby = self.form_data.get('groupby')
         columns = self.form_data.get('columns')
         metrics = self.form_data.get('metrics')
@@ -745,7 +745,7 @@ class WordCloudViz(BaseViz):
     is_timeseries = False
 
     def query_obj(self):
-        d = super(WordCloudViz, self).query_obj()
+        d = super().query_obj()
         d['groupby'] = [self.form_data.get('series')]
         return d
 
@@ -830,7 +830,7 @@ class CalHeatmapViz(BaseViz):
         }
 
     def query_obj(self):
-        d = super(CalHeatmapViz, self).query_obj()
+        d = super().query_obj()
         fd = self.form_data
         d['metrics'] = fd.get('metrics')
         return d
@@ -941,7 +941,7 @@ class BubbleViz(NVD3Viz):
 
     def query_obj(self):
         form_data = self.form_data
-        d = super(BubbleViz, self).query_obj()
+        d = super().query_obj()
         d['groupby'] = [
             form_data.get('entity'),
         ]
@@ -991,7 +991,7 @@ class BulletViz(NVD3Viz):
 
     def query_obj(self):
         form_data = self.form_data
-        d = super(BulletViz, self).query_obj()
+        d = super().query_obj()
         self.metric = form_data.get('metric')
 
         def as_strings(field):
@@ -1039,7 +1039,7 @@ class BigNumberViz(BaseViz):
     is_timeseries = True
 
     def query_obj(self):
-        d = super(BigNumberViz, self).query_obj()
+        d = super().query_obj()
         metric = self.form_data.get('metric')
         if not metric:
             raise Exception(_('Pick a metric!'))
@@ -1058,7 +1058,7 @@ class BigNumberTotalViz(BaseViz):
     is_timeseries = False
 
     def query_obj(self):
-        d = super(BigNumberTotalViz, self).query_obj()
+        d = super().query_obj()
         metric = self.form_data.get('metric')
         if not metric:
             raise Exception(_('Pick a metric!'))
@@ -1299,7 +1299,7 @@ class NVD3DualLineViz(NVD3Viz):
     is_timeseries = True
 
     def query_obj(self):
-        d = super(NVD3DualLineViz, self).query_obj()
+        d = super().query_obj()
         m1 = self.form_data.get('metric')
         m2 = self.form_data.get('metric_2')
         d['metrics'] = [m1, m2]
@@ -1383,7 +1383,7 @@ class NVD3TimePivotViz(NVD3TimeSeriesViz):
     verbose_name = _('Time Series - Period Pivot')
 
     def query_obj(self):
-        d = super(NVD3TimePivotViz, self).query_obj()
+        d = super().query_obj()
         d['metrics'] = [self.form_data.get('metric')]
         return d
 
@@ -1465,7 +1465,7 @@ class HistogramViz(BaseViz):
 
     def query_obj(self):
         """Returns the query object for this visualization"""
-        d = super(HistogramViz, self).query_obj()
+        d = super().query_obj()
         d['row_limit'] = self.form_data.get(
             'row_limit', int(config.get('VIZ_ROW_LIMIT')))
         numeric_columns = self.form_data.get('all_columns_x')
@@ -1511,7 +1511,7 @@ class DistributionBarViz(DistributionPieViz):
     is_timeseries = False
 
     def query_obj(self):
-        d = super(DistributionBarViz, self).query_obj()  # noqa
+        d = super().query_obj()  # noqa
         fd = self.form_data
         if (
             len(d['groupby']) <
@@ -1592,7 +1592,7 @@ class SunburstViz(BaseViz):
         return json.loads(df.to_json(orient='values'))
 
     def query_obj(self):
-        qry = super(SunburstViz, self).query_obj()
+        qry = super().query_obj()
         fd = self.form_data
         qry['metrics'] = [fd['metric']]
         secondary_metric = fd.get('secondary_metric')
@@ -1611,7 +1611,7 @@ class SankeyViz(BaseViz):
     credits = '<a href="https://www.npmjs.com/package/d3-sankey">d3-sankey on npm</a>'
 
     def query_obj(self):
-        qry = super(SankeyViz, self).query_obj()
+        qry = super().query_obj()
         if len(qry['groupby']) != 2:
             raise Exception(_('Pick exactly 2 columns as [Source / Target]'))
         qry['metrics'] = [
@@ -1662,7 +1662,7 @@ class DirectedForceViz(BaseViz):
     is_timeseries = False
 
     def query_obj(self):
-        qry = super(DirectedForceViz, self).query_obj()
+        qry = super().query_obj()
         if len(self.form_data['groupby']) != 2:
             raise Exception(_("Pick exactly 2 columns to 'Group By'"))
         qry['metrics'] = [self.form_data['metric']]
@@ -1683,7 +1683,7 @@ class ChordViz(BaseViz):
     is_timeseries = False
 
     def query_obj(self):
-        qry = super(ChordViz, self).query_obj()
+        qry = super().query_obj()
         fd = self.form_data
         qry['groupby'] = [fd.get('groupby'), fd.get('columns')]
         qry['metrics'] = [utils.get_metric_name(fd.get('metric'))]
@@ -1716,7 +1716,7 @@ class CountryMapViz(BaseViz):
     credits = 'From bl.ocks.org By john-guerra'
 
     def query_obj(self):
-        qry = super(CountryMapViz, self).query_obj()
+        qry = super().query_obj()
         qry['metrics'] = [
             self.form_data['metric']]
         qry['groupby'] = [self.form_data['entity']]
@@ -1744,7 +1744,7 @@ class WorldMapViz(BaseViz):
     credits = 'datamaps on <a href="https://www.npmjs.com/package/datamaps">npm</a>'
 
     def query_obj(self):
-        qry = super(WorldMapViz, self).query_obj()
+        qry = super().query_obj()
         qry['groupby'] = [self.form_data['entity']]
         return qry
 
@@ -1802,7 +1802,7 @@ class FilterBoxViz(BaseViz):
         return None
 
     def run_extra_queries(self):
-        qry = super(FilterBoxViz, self).query_obj()
+        qry = super().query_obj()
         filters = self.form_data.get('filter_configs') or []
         qry['row_limit'] = self.filter_row_limit
         self.dataframes = {}
@@ -1880,7 +1880,7 @@ class ParallelCoordinatesViz(BaseViz):
     is_timeseries = False
 
     def query_obj(self):
-        d = super(ParallelCoordinatesViz, self).query_obj()
+        d = super().query_obj()
         fd = self.form_data
         d['groupby'] = [fd.get('series')]
         return d
@@ -1901,7 +1901,7 @@ class HeatmapViz(BaseViz):
         'bl.ocks.org</a>')
 
     def query_obj(self):
-        d = super(HeatmapViz, self).query_obj()
+        d = super().query_obj()
         fd = self.form_data
         d['metrics'] = [fd.get('metric')]
         d['groupby'] = [fd.get('all_columns_x'), fd.get('all_columns_y')]
@@ -1967,7 +1967,7 @@ class MapboxViz(BaseViz):
         '<a href=https://www.mapbox.com/mapbox-gl-js/api/>Mapbox GL JS</a>')
 
     def query_obj(self):
-        d = super(MapboxViz, self).query_obj()
+        d = super().query_obj()
         fd = self.form_data
         label_col = fd.get('mapbox_label')
 
@@ -2205,7 +2205,7 @@ class BaseDeckGLViz(BaseViz):
         if fd.get('filter_nulls', True):
             self.add_null_filters()
 
-        d = super(BaseDeckGLViz, self).query_obj()
+        d = super().query_obj()
         gb = []
 
         for key in self.spatial_control_keys:
@@ -2271,7 +2271,7 @@ class DeckScatterViz(BaseDeckGLViz):
             fd.get('time_grain_sqla') or fd.get('granularity'))
         self.point_radius_fixed = (
             fd.get('point_radius_fixed') or {'type': 'fix', 'value': 500})
-        return super(DeckScatterViz, self).query_obj()
+        return super().query_obj()
 
     def get_metrics(self):
         self.metric = None
@@ -2298,7 +2298,7 @@ class DeckScatterViz(BaseDeckGLViz):
         self.dim = self.form_data.get('dimension')
         if self.point_radius_fixed.get('type') != 'metric':
             self.fixed_value = self.point_radius_fixed.get('value')
-        return super(DeckScatterViz, self).get_data(df)
+        return super().get_data(df)
 
 
 class DeckScreengrid(BaseDeckGLViz):
@@ -2313,7 +2313,7 @@ class DeckScreengrid(BaseDeckGLViz):
     def query_obj(self):
         fd = self.form_data
         self.is_timeseries = fd.get('time_grain_sqla') or fd.get('granularity')
-        return super(DeckScreengrid, self).query_obj()
+        return super().query_obj()
 
     def get_properties(self, d):
         return {
@@ -2324,7 +2324,7 @@ class DeckScreengrid(BaseDeckGLViz):
 
     def get_data(self, df):
         self.metric_label = utils.get_metric_name(self.metric)
-        return super(DeckScreengrid, self).get_data(df)
+        return super().get_data(df)
 
 
 class DeckGrid(BaseDeckGLViz):
@@ -2343,7 +2343,7 @@ class DeckGrid(BaseDeckGLViz):
 
     def get_data(self, df):
         self.metric_label = utils.get_metric_name(self.metric)
-        return super(DeckGrid, self).get_data(df)
+        return super().get_data(df)
 
 
 def geohash_to_json(geohash_code):
@@ -2374,7 +2374,7 @@ class DeckPathViz(BaseDeckGLViz):
     def query_obj(self):
         fd = self.form_data
         self.is_timeseries = fd.get('time_grain_sqla') or fd.get('granularity')
-        d = super(DeckPathViz, self).query_obj()
+        d = super().query_obj()
         self.metric = fd.get('metric')
         line_col = fd.get('line_column')
         if d['metrics']:
@@ -2401,7 +2401,7 @@ class DeckPathViz(BaseDeckGLViz):
 
     def get_data(self, df):
         self.metric_label = utils.get_metric_name(self.metric)
-        return super(DeckPathViz, self).get_data(df)
+        return super().get_data(df)
 
 
 class DeckPolygon(DeckPathViz):
@@ -2416,7 +2416,7 @@ class DeckPolygon(DeckPathViz):
         fd = self.form_data
         self.elevation = (
             fd.get('point_radius_fixed') or {'type': 'fix', 'value': 500})
-        return super(DeckPolygon, self).query_obj()
+        return super().query_obj()
 
     def get_metrics(self):
         metrics = [self.form_data.get('metric')]
@@ -2425,7 +2425,7 @@ class DeckPolygon(DeckPathViz):
         return [metric for metric in metrics if metric]
 
     def get_properties(self, d):
-        super(DeckPolygon, self).get_properties(d)
+        super().get_properties(d)
         fd = self.form_data
         elevation = fd['point_radius_fixed']['value']
         type_ = fd['point_radius_fixed']['type']
@@ -2460,7 +2460,7 @@ class DeckGeoJson(BaseDeckGLViz):
     verbose_name = _('Deck.gl - GeoJSON')
 
     def query_obj(self):
-        d = super(DeckGeoJson, self).query_obj()
+        d = super().query_obj()
         d['columns'] += [self.form_data.get('geojson')]
         d['metrics'] = []
         d['groupby'] = []
@@ -2484,7 +2484,7 @@ class DeckArc(BaseDeckGLViz):
         fd = self.form_data
         self.is_timeseries = bool(
             fd.get('time_grain_sqla') or fd.get('granularity'))
-        return super(DeckArc, self).query_obj()
+        return super().query_obj()
 
     def get_properties(self, d):
         dim = self.form_data.get('dimension')
@@ -2496,7 +2496,7 @@ class DeckArc(BaseDeckGLViz):
         }
 
     def get_data(self, df):
-        d = super(DeckArc, self).get_data(df)
+        d = super().get_data(df)
 
         return {
             'features': d['features'],
@@ -2514,7 +2514,7 @@ class EventFlowViz(BaseViz):
     is_timeseries = True
 
     def query_obj(self):
-        query = super(EventFlowViz, self).query_obj()
+        query = super().query_obj()
         form_data = self.form_data
 
         event_key = form_data.get('all_columns_x')
@@ -2603,7 +2603,7 @@ class RoseViz(NVD3TimeSeriesViz):
     is_timeseries = True
 
     def get_data(self, df):
-        data = super(RoseViz, self).get_data(df)
+        data = super().get_data(df)
         result = {}
         for datum in data:
             key = datum['key']
@@ -2631,7 +2631,7 @@ class PartitionViz(NVD3TimeSeriesViz):
     verbose_name = _('Partition Diagram')
 
     def query_obj(self):
-        query_obj = super(PartitionViz, self).query_obj()
+        query_obj = super().query_obj()
         time_op = self.form_data.get('time_series_option', 'not_time')
         # Return time series data if the user specifies so
         query_obj['is_timeseries'] = time_op != 'not_time'


Mime
View raw message