You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2020/09/18 04:30:28 UTC

[incubator-superset] branch master updated: fix: update pylint disabled checks in common/query_context.py (#10941)

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 e21a354  fix: update pylint disabled checks in common/query_context.py (#10941)
e21a354 is described below

commit e21a354b3b560465a866c25dd687fbeef73eee31
Author: Kasia Kucharczyk <25...@users.noreply.github.com>
AuthorDate: Fri Sep 18 06:30:02 2020 +0200

    fix: update pylint disabled checks in common/query_context.py (#10941)
    
    * Updated common/query_context.py
    - removed disabled pylint rule no-self-use from `df_metrics_to_num` since it has `@staticmethod`
    - applied black on the file
    
    * Removed disabled lint check `too-many-locals` in get_df_payload method. Applied black.
    
    * Method `get_data()` has self param:
    - removing # pylint: disable=no-self-use
    - autoformatting
---
 superset/common/query_context.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/superset/common/query_context.py b/superset/common/query_context.py
index 0801a70..f498f1b 100644
--- a/superset/common/query_context.py
+++ b/superset/common/query_context.py
@@ -124,17 +124,13 @@ class QueryContext:
         }
 
     @staticmethod
-    def df_metrics_to_num(  # pylint: disable=no-self-use
-        df: pd.DataFrame, query_object: QueryObject
-    ) -> None:
+    def df_metrics_to_num(df: pd.DataFrame, query_object: QueryObject) -> None:
         """Converting metrics to numeric when pandas.read_sql cannot"""
         for col, dtype in df.dtypes.items():
             if dtype.type == np.object_ and col in query_object.metrics:
                 df[col] = pd.to_numeric(df[col], errors="coerce")
 
-    def get_data(
-        self, df: pd.DataFrame,
-    ) -> Union[str, List[Dict[str, Any]]]:  # pylint: disable=no-self-use
+    def get_data(self, df: pd.DataFrame,) -> Union[str, List[Dict[str, Any]]]:
         if self.result_format == utils.ChartDataResultFormat.CSV:
             include_index = not isinstance(df.index, pd.RangeIndex)
             result = df.to_csv(index=include_index, **config["CSV_EXPORT"])
@@ -204,7 +200,7 @@ class QueryContext:
         )
         return cache_key
 
-    def get_df_payload(  # pylint: disable=too-many-locals,too-many-statements
+    def get_df_payload(  # pylint: disable=too-many-statements
         self, query_obj: QueryObject, **kwargs: Any
     ) -> Dict[str, Any]:
         """Handles caching around the df payload retrieval"""