mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
chore: updated lint rules in models module (#11036)
* 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`
This commit is contained in:
parent
6b318c477e
commit
63d0e801ad
@ -55,7 +55,6 @@ from superset.utils.dashboard_filter_scopes_converter import (
|
|||||||
from superset.utils.urls import get_url_path
|
from superset.utils.urls import get_url_path
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# pylint: disable=unused-import
|
|
||||||
from superset.connectors.base.models import BaseDatasource
|
from superset.connectors.base.models import BaseDatasource
|
||||||
|
|
||||||
metadata = Model.metadata # pylint: disable=no-member
|
metadata = Model.metadata # pylint: disable=no-member
|
||||||
@ -255,8 +254,11 @@ class Dashboard( # pylint: disable=too-many-instance-attributes
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_obj( # pylint: disable=too-many-locals,too-many-branches,too-many-statements
|
def import_obj(
|
||||||
cls, dashboard_to_import: "Dashboard", import_time: Optional[int] = None,
|
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
|
||||||
|
cls,
|
||||||
|
dashboard_to_import: "Dashboard",
|
||||||
|
import_time: Optional[int] = None,
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Imports the dashboard from the object to the database.
|
"""Imports the dashboard from the object to the database.
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ from superset.models.helpers import AuditMixinNullable
|
|||||||
from superset.utils import core as utils
|
from superset.utils import core as utils
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from superset.connectors.base.models import ( # pylint: disable=unused-import
|
from superset.connectors.base.models import BaseDatasource
|
||||||
BaseDatasource,
|
|
||||||
)
|
|
||||||
|
|
||||||
config = app.config
|
config = app.config
|
||||||
|
|
||||||
@ -74,7 +72,6 @@ class DatasourceAccessRequest(Model, AuditMixinNullable):
|
|||||||
for role in pv.role:
|
for role in pv.role:
|
||||||
if role.name in self.ROLES_DENYLIST:
|
if role.name in self.ROLES_DENYLIST:
|
||||||
continue
|
continue
|
||||||
# pylint: disable=no-member
|
|
||||||
href = (
|
href = (
|
||||||
f"/superset/approve?datasource_type={self.datasource_type}&"
|
f"/superset/approve?datasource_type={self.datasource_type}&"
|
||||||
f"datasource_id={self.datasource_id}&"
|
f"datasource_id={self.datasource_id}&"
|
||||||
@ -87,8 +84,7 @@ class DatasourceAccessRequest(Model, AuditMixinNullable):
|
|||||||
@property
|
@property
|
||||||
def user_roles(self) -> str:
|
def user_roles(self) -> str:
|
||||||
action_list = ""
|
action_list = ""
|
||||||
for role in self.created_by.roles: # pylint: disable=no-member
|
for role in self.created_by.roles:
|
||||||
# pylint: disable=no-member
|
|
||||||
href = (
|
href = (
|
||||||
f"/superset/approve?datasource_type={self.datasource_type}&"
|
f"/superset/approve?datasource_type={self.datasource_type}&"
|
||||||
f"datasource_id={self.datasource_id}&"
|
f"datasource_id={self.datasource_id}&"
|
||||||
|
@ -42,7 +42,6 @@ else:
|
|||||||
from superset.viz import BaseViz, viz_types # type: ignore
|
from superset.viz import BaseViz, viz_types # type: ignore
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# pylint: disable=unused-import
|
|
||||||
from superset.connectors.base.models import BaseDatasource
|
from superset.connectors.base.models import BaseDatasource
|
||||||
|
|
||||||
metadata = Model.metadata # pylint: disable=no-member
|
metadata = Model.metadata # pylint: disable=no-member
|
||||||
@ -333,8 +332,7 @@ class Slice(
|
|||||||
return f"/superset/explore/?form_data=%7B%22slice_id%22%3A%20{self.id}%7D"
|
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:
|
def set_related_perm(_mapper: Mapper, _connection: Connection, target: Slice) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
src_class = target.cls_model
|
src_class = target.cls_model
|
||||||
id_ = target.datasource_id
|
id_ = target.datasource_id
|
||||||
if id_:
|
if id_:
|
||||||
@ -344,8 +342,8 @@ def set_related_perm(mapper: Mapper, connection: Connection, target: Slice) -> N
|
|||||||
target.schema_perm = ds.schema_perm
|
target.schema_perm = ds.schema_perm
|
||||||
|
|
||||||
|
|
||||||
def event_after_chart_changed( # pylint: disable=unused-argument
|
def event_after_chart_changed(
|
||||||
mapper: Mapper, connection: Connection, target: Slice
|
_mapper: Mapper, _connection: Connection, target: Slice
|
||||||
) -> None:
|
) -> None:
|
||||||
url = get_url_path("Superset.slice", slice_id=target.id, standalone="true")
|
url = get_url_path("Superset.slice", slice_id=target.id, standalone="true")
|
||||||
cache_chart_thumbnail.delay(url, target.digest, force=True)
|
cache_chart_thumbnail.delay(url, target.digest, force=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user