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
This commit is contained in:
Kasia Kucharczyk 2020-09-18 06:30:02 +02:00 committed by GitHub
parent 141ef4a188
commit e21a354b3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -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"""