You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jo...@apache.org on 2019/01/11 02:22:12 UTC

[incubator-superset] 08/43: fix lint

This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch feature--embeddable-charts-pilot
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 1e991d3b87cb255222c676be80d9ae7fb20c0671
Author: Conglei Shi <co...@airbnb.com>
AuthorDate: Wed Nov 14 22:28:34 2018 -0800

    fix lint
---
 superset/common/query_context.py |  2 +-
 superset/common/query_object.py  | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/superset/common/query_context.py b/superset/common/query_context.py
index 751da71..8a26903 100644
--- a/superset/common/query_context.py
+++ b/superset/common/query_context.py
@@ -225,7 +225,7 @@ class QueryContext:
                     cache.delete(cache_key)
         return {
             'cache_key': cache_key,
-            'cached_dttm': cache_value['dttm'] if cache_value not None else None
+            'cached_dttm': cache_value['dttm'] if cache_value is not None else None,
             'cache_timeout': self.cache_timeout,
             'df': df,
             'error': error_message,
diff --git a/superset/common/query_object.py b/superset/common/query_object.py
index 1a38885..ce2685e 100644
--- a/superset/common/query_object.py
+++ b/superset/common/query_object.py
@@ -1,10 +1,11 @@
 # pylint: disable=R
-from typing import Dict, List, Optional
+import hashlib
+import simplejson as json
 
+from typing import Dict, List, Optional
 from superset import app
 from superset.utils import core as utils
-import hashlib
-import simplejson as json
+
 
 # TODO: Type Metrics dictionary with TypedDict when it becomes a vanilla python type
 # https://github.com/python/mypy/issues/5288
@@ -75,14 +76,14 @@ class QueryObject:
         for k in ['from_dttm', 'to_dttm']:
             del cache_dict[k]
 
-        cache_dict['time_range'] = self.form_data.get('time_range')
+        cache_dict['time_range'] = self.time_range
         json_data = self.json_dumps(cache_dict, sort_keys=True)
         return hashlib.md5(json_data.encode('utf-8')).hexdigest()
-    
+
     def json_dumps(self, obj, sort_keys=False):
         return json.dumps(
             obj,
             default=utils.json_int_dttm_ser,
             ignore_nan=True,
             sort_keys=sort_keys,
-        )
\ No newline at end of file
+        )