From ee022be3157d92629c2d4a0bb9bfe42e19e426ce Mon Sep 17 00:00:00 2001 From: Kasia Kucharczyk Date: Mon, 21 Sep 2020 16:40:15 +0200 Subject: [PATCH 1/3] Removed not needed disabled pylint rules from `set_dash_metadata`: - `disable=too-many-locals`, - `too-many-branches`, - `too-many-statements` --- superset/dashboards/dao.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/dashboards/dao.py b/superset/dashboards/dao.py index 3cffe11f7e0ac..bddc467dd5533 100644 --- a/superset/dashboards/dao.py +++ b/superset/dashboards/dao.py @@ -81,7 +81,7 @@ def bulk_delete(models: Optional[List[Dashboard]], commit: bool = True) -> None: raise ex @staticmethod - def set_dash_metadata( # pylint: disable=too-many-locals,too-many-branches,too-many-statements + def set_dash_metadata( dashboard: Dashboard, data: Dict[Any, Any], old_to_new_slice_ids: Optional[Dict[int, int]] = None, From 241f6c21b3e69cd999207b01f7ffe132f2cc94e6 Mon Sep 17 00:00:00 2001 From: Kasia Kucharczyk Date: Mon, 21 Sep 2020 17:06:25 +0200 Subject: [PATCH 2/3] Changed broad exception to KeyError. --- superset/databases/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/databases/utils.py b/superset/databases/utils.py index 4d475177f7211..cbe2f903cccaf 100644 --- a/superset/databases/utils.py +++ b/superset/databases/utils.py @@ -44,7 +44,7 @@ def get_indexes_metadata( def get_col_type(col: Dict[Any, Any]) -> str: try: dtype = f"{col['type']}" - except Exception: # pylint: disable=broad-except + except KeyError: # sqla.types.JSON __str__ has a bug, so using __class__. dtype = col["type"].__class__.__name__ return dtype From 618a48690802a49283440c34d0fdc488bca04804 Mon Sep 17 00:00:00 2001 From: Kasia Kucharczyk Date: Wed, 23 Sep 2020 15:38:01 +0200 Subject: [PATCH 3/3] Reverted broad_exception in get_col_type in utils --- superset/databases/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/databases/utils.py b/superset/databases/utils.py index cbe2f903cccaf..4d475177f7211 100644 --- a/superset/databases/utils.py +++ b/superset/databases/utils.py @@ -44,7 +44,7 @@ def get_indexes_metadata( def get_col_type(col: Dict[Any, Any]) -> str: try: dtype = f"{col['type']}" - except KeyError: + except Exception: # pylint: disable=broad-except # sqla.types.JSON __str__ has a bug, so using __class__. dtype = col["type"].__class__.__name__ return dtype