From 0fe8e115956bab46d191dab2fafcf8146ae6e527 Mon Sep 17 00:00:00 2001 From: SpiderMan Date: Wed, 6 Apr 2022 15:44:53 -0400 Subject: [PATCH 1/4] fix lint issue --- superset/utils/csv.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/superset/utils/csv.py b/superset/utils/csv.py index 42d2c557832e9..b8042d8448607 100644 --- a/superset/utils/csv.py +++ b/superset/utils/csv.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +import logging import re import urllib.request from typing import Any, Dict, Optional @@ -22,6 +23,8 @@ import pandas as pd import simplejson +logger = logging.getLogger(__name__) + negative_number_re = re.compile(r"^-[0-9.]+$") # This regex will match if the string starts with: @@ -95,6 +98,9 @@ def get_chart_dataframe( return None result = simplejson.loads(content.decode("utf-8")) + pd.set_option( + "display.float_format", lambda x: str(x) + ) # need to convert float value to string to show full long number df = pd.DataFrame.from_dict(result["result"][0]["data"]) # rebuild hierarchical columns and index From a5fc284e8d271dc725ee609e2e3e0385b09669aa Mon Sep 17 00:00:00 2001 From: SpiderMan Date: Wed, 6 Apr 2022 16:17:52 -0400 Subject: [PATCH 2/4] resolve comment --- superset/utils/csv.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/superset/utils/csv.py b/superset/utils/csv.py index b8042d8448607..4d982da0b5c0a 100644 --- a/superset/utils/csv.py +++ b/superset/utils/csv.py @@ -14,7 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -import logging import re import urllib.request from typing import Any, Dict, Optional @@ -23,8 +22,6 @@ import pandas as pd import simplejson -logger = logging.getLogger(__name__) - negative_number_re = re.compile(r"^-[0-9.]+$") # This regex will match if the string starts with: @@ -98,9 +95,8 @@ def get_chart_dataframe( return None result = simplejson.loads(content.decode("utf-8")) - pd.set_option( - "display.float_format", lambda x: str(x) - ) # need to convert float value to string to show full long number + # need to convert float value to string to show full long number + pd.set_option("display.float_format", lambda x: str(x)) df = pd.DataFrame.from_dict(result["result"][0]["data"]) # rebuild hierarchical columns and index From ab07d4ada783505a6dc3933254dc0c6b6e844669 Mon Sep 17 00:00:00 2001 From: SpiderMan Date: Thu, 21 Apr 2022 15:43:43 -0400 Subject: [PATCH 3/4] fix pipeline broken issue --- superset/utils/csv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/superset/utils/csv.py b/superset/utils/csv.py index 4d982da0b5c0a..c7c150c370e66 100644 --- a/superset/utils/csv.py +++ b/superset/utils/csv.py @@ -96,7 +96,9 @@ def get_chart_dataframe( result = simplejson.loads(content.decode("utf-8")) # need to convert float value to string to show full long number - pd.set_option("display.float_format", lambda x: str(x)) + pd.set_option( + "display.float_format", lambda x: str(x) + ) # pylint: disable=unnecessary-lambda df = pd.DataFrame.from_dict(result["result"][0]["data"]) # rebuild hierarchical columns and index From 8edfcffa7bb1d061995d297df643e80b1901a340 Mon Sep 17 00:00:00 2001 From: SpiderMan Date: Thu, 21 Apr 2022 17:03:06 -0400 Subject: [PATCH 4/4] resolve pipeline broken issue --- superset/utils/csv.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/superset/utils/csv.py b/superset/utils/csv.py index c7c150c370e66..0dc84ff36a3de 100644 --- a/superset/utils/csv.py +++ b/superset/utils/csv.py @@ -90,15 +90,16 @@ def get_chart_csv_data( def get_chart_dataframe( chart_url: str, auth_cookies: Optional[Dict[str, str]] = None ) -> Optional[pd.DataFrame]: + # Disable all the unnecessary-lambda violations in this function + # pylint: disable=unnecessary-lambda content = get_chart_csv_data(chart_url, auth_cookies) if content is None: return None result = simplejson.loads(content.decode("utf-8")) + # need to convert float value to string to show full long number - pd.set_option( - "display.float_format", lambda x: str(x) - ) # pylint: disable=unnecessary-lambda + pd.set_option("display.float_format", lambda x: str(x)) df = pd.DataFrame.from_dict(result["result"][0]["data"]) # rebuild hierarchical columns and index