Skip to content

Commit

Permalink
chore: updated lint rules in models module (apache#11036)
Browse files Browse the repository at this point in the history
* Removed disabled pylint rule `unused_import` from `dashboards.py` in `models` module. Added missing break in too long line. Formatting.

* Changed `datasource_access_request.py` in models` module: removed disabled pylint rule `unused_import`, removed `no-member` disabled rules which aren't needed. Formatting

* Changed `slice.py` in models` module: removed disabled pylint rule `unused_import`, changed unused arguments to private and removed disabled rule `unused-argument`
  • Loading branch information
kkucharc authored and auxten committed Nov 20, 2020
1 parent 50b25a8 commit c35f1df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
8 changes: 5 additions & 3 deletions superset/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
from superset.utils.urls import get_url_path

if TYPE_CHECKING:
# pylint: disable=unused-import
from superset.connectors.base.models import BaseDatasource

metadata = Model.metadata # pylint: disable=no-member
Expand Down Expand Up @@ -255,8 +254,11 @@ def position(self) -> Dict[str, Any]:
return {}

@classmethod
def import_obj( # pylint: disable=too-many-locals,too-many-branches,too-many-statements
cls, dashboard_to_import: "Dashboard", import_time: Optional[int] = None,
def import_obj(
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
cls,
dashboard_to_import: "Dashboard",
import_time: Optional[int] = None,
) -> int:
"""Imports the dashboard from the object to the database.
Expand Down
8 changes: 2 additions & 6 deletions superset/models/datasource_access_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
from superset.utils import core as utils

if TYPE_CHECKING:
from superset.connectors.base.models import ( # pylint: disable=unused-import
BaseDatasource,
)
from superset.connectors.base.models import BaseDatasource

config = app.config

Expand Down Expand Up @@ -74,7 +72,6 @@ def roles_with_datasource(self) -> str:
for role in pv.role:
if role.name in self.ROLES_DENYLIST:
continue
# pylint: disable=no-member
href = (
f"/superset/approve?datasource_type={self.datasource_type}&"
f"datasource_id={self.datasource_id}&"
Expand All @@ -87,8 +84,7 @@ def roles_with_datasource(self) -> str:
@property
def user_roles(self) -> str:
action_list = ""
for role in self.created_by.roles: # pylint: disable=no-member
# pylint: disable=no-member
for role in self.created_by.roles:
href = (
f"/superset/approve?datasource_type={self.datasource_type}&"
f"datasource_id={self.datasource_id}&"
Expand Down
8 changes: 3 additions & 5 deletions superset/models/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
from superset.viz import BaseViz, viz_types # type: ignore

if TYPE_CHECKING:
# pylint: disable=unused-import
from superset.connectors.base.models import BaseDatasource

metadata = Model.metadata # pylint: disable=no-member
Expand Down Expand Up @@ -333,8 +332,7 @@ def url(self) -> str:
return f"/superset/explore/?form_data=%7B%22slice_id%22%3A%20{self.id}%7D"


def set_related_perm(mapper: Mapper, connection: Connection, target: Slice) -> None:
# pylint: disable=unused-argument
def set_related_perm(_mapper: Mapper, _connection: Connection, target: Slice) -> None:
src_class = target.cls_model
id_ = target.datasource_id
if id_:
Expand All @@ -344,8 +342,8 @@ def set_related_perm(mapper: Mapper, connection: Connection, target: Slice) -> N
target.schema_perm = ds.schema_perm


def event_after_chart_changed( # pylint: disable=unused-argument
mapper: Mapper, connection: Connection, target: Slice
def event_after_chart_changed(
_mapper: Mapper, _connection: Connection, target: Slice
) -> None:
url = get_url_path("Superset.slice", slice_id=target.id, standalone="true")
cache_chart_thumbnail.delay(url, target.digest, force=True)
Expand Down

0 comments on commit c35f1df

Please sign in to comment.