mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
Changed tags.py
and helpers.py
in models
module: removed disabled pylint rule unused_import
, changed unused arguments to private and removed disabled rule unused-argument. Removed redundant rules.
(#11037)
This commit is contained in:
parent
63d0e801ad
commit
92dd257ef4
@ -136,7 +136,7 @@ class ImportMixin:
|
|||||||
parent: Optional[Any] = None,
|
parent: Optional[Any] = None,
|
||||||
recursive: bool = True,
|
recursive: bool = True,
|
||||||
sync: Optional[List[str]] = None,
|
sync: Optional[List[str]] = None,
|
||||||
) -> Any: # pylint: disable=too-many-arguments,too-many-locals,too-many-branches
|
) -> Any:
|
||||||
"""Import obj from a dictionary"""
|
"""Import obj from a dictionary"""
|
||||||
if sync is None:
|
if sync is None:
|
||||||
sync = []
|
sync = []
|
||||||
|
@ -29,10 +29,10 @@ from sqlalchemy.orm.mapper import Mapper
|
|||||||
from superset.models.helpers import AuditMixinNullable
|
from superset.models.helpers import AuditMixinNullable
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from superset.models.core import FavStar # pylint: disable=unused-import
|
from superset.models.core import FavStar
|
||||||
from superset.models.dashboard import Dashboard # pylint: disable=unused-import
|
from superset.models.dashboard import Dashboard
|
||||||
from superset.models.slice import Slice # pylint: disable=unused-import
|
from superset.models.slice import Slice
|
||||||
from superset.models.sql_lab import Query # pylint: disable=unused-import
|
from superset.models.sql_lab import Query
|
||||||
|
|
||||||
Session = sessionmaker(autoflush=False)
|
Session = sessionmaker(autoflush=False)
|
||||||
|
|
||||||
@ -136,11 +136,10 @@ class ObjectUpdater:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def after_insert(
|
def after_insert(
|
||||||
cls,
|
cls,
|
||||||
mapper: Mapper,
|
_mapper: Mapper,
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
target: Union["Dashboard", "FavStar", "Slice"],
|
target: Union["Dashboard", "FavStar", "Slice"],
|
||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
session = Session(bind=connection)
|
session = Session(bind=connection)
|
||||||
|
|
||||||
# add `owner:` tags
|
# add `owner:` tags
|
||||||
@ -158,11 +157,10 @@ class ObjectUpdater:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def after_update(
|
def after_update(
|
||||||
cls,
|
cls,
|
||||||
mapper: Mapper,
|
_mapper: Mapper,
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
target: Union["Dashboard", "FavStar", "Slice"],
|
target: Union["Dashboard", "FavStar", "Slice"],
|
||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
session = Session(bind=connection)
|
session = Session(bind=connection)
|
||||||
|
|
||||||
# delete current `owner:` tags
|
# delete current `owner:` tags
|
||||||
@ -188,11 +186,10 @@ class ObjectUpdater:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def after_delete(
|
def after_delete(
|
||||||
cls,
|
cls,
|
||||||
mapper: Mapper,
|
_mapper: Mapper,
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
target: Union["Dashboard", "FavStar", "Slice"],
|
target: Union["Dashboard", "FavStar", "Slice"],
|
||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
session = Session(bind=connection)
|
session = Session(bind=connection)
|
||||||
|
|
||||||
# delete row from `tagged_objects`
|
# delete row from `tagged_objects`
|
||||||
@ -234,9 +231,8 @@ class QueryUpdater(ObjectUpdater):
|
|||||||
class FavStarUpdater:
|
class FavStarUpdater:
|
||||||
@classmethod
|
@classmethod
|
||||||
def after_insert(
|
def after_insert(
|
||||||
cls, mapper: Mapper, connection: Connection, target: "FavStar"
|
cls, _mapper: Mapper, connection: Connection, target: "FavStar"
|
||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
session = Session(bind=connection)
|
session = Session(bind=connection)
|
||||||
name = "favorited_by:{0}".format(target.user_id)
|
name = "favorited_by:{0}".format(target.user_id)
|
||||||
tag = get_tag(name, session, TagTypes.favorited_by)
|
tag = get_tag(name, session, TagTypes.favorited_by)
|
||||||
@ -251,9 +247,8 @@ class FavStarUpdater:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def after_delete(
|
def after_delete(
|
||||||
cls, mapper: Mapper, connection: Connection, target: "FavStar"
|
cls, _mapper: Mapper, connection: Connection, target: "FavStar"
|
||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
session = Session(bind=connection)
|
session = Session(bind=connection)
|
||||||
name = "favorited_by:{0}".format(target.user_id)
|
name = "favorited_by:{0}".format(target.user_id)
|
||||||
query = (
|
query = (
|
||||||
|
Loading…
Reference in New Issue
Block a user