Skip to content

Commit

Permalink
Changed tags.py and helpers.py in models module: removed disabl…
Browse files Browse the repository at this point in the history
…ed pylint rule `unused_import`, changed unused arguments to private and removed disabled rule `unused-argument. Removed redundant rules.` (#11037)
  • Loading branch information
kkucharc authored Sep 24, 2020
1 parent 63d0e80 commit 92dd257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion superset/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def import_from_dict(
parent: Optional[Any] = None,
recursive: bool = True,
sync: Optional[List[str]] = None,
) -> Any: # pylint: disable=too-many-arguments,too-many-locals,too-many-branches
) -> Any:
"""Import obj from a dictionary"""
if sync is None:
sync = []
Expand Down
23 changes: 9 additions & 14 deletions superset/models/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
from superset.models.helpers import AuditMixinNullable

if TYPE_CHECKING:
from superset.models.core import FavStar # pylint: disable=unused-import
from superset.models.dashboard import Dashboard # pylint: disable=unused-import
from superset.models.slice import Slice # pylint: disable=unused-import
from superset.models.sql_lab import Query # pylint: disable=unused-import
from superset.models.core import FavStar
from superset.models.dashboard import Dashboard
from superset.models.slice import Slice
from superset.models.sql_lab import Query

Session = sessionmaker(autoflush=False)

Expand Down Expand Up @@ -136,11 +136,10 @@ def _add_owners(
@classmethod
def after_insert(
cls,
mapper: Mapper,
_mapper: Mapper,
connection: Connection,
target: Union["Dashboard", "FavStar", "Slice"],
) -> None:
# pylint: disable=unused-argument
session = Session(bind=connection)

# add `owner:` tags
Expand All @@ -158,11 +157,10 @@ def after_insert(
@classmethod
def after_update(
cls,
mapper: Mapper,
_mapper: Mapper,
connection: Connection,
target: Union["Dashboard", "FavStar", "Slice"],
) -> None:
# pylint: disable=unused-argument
session = Session(bind=connection)

# delete current `owner:` tags
Expand All @@ -188,11 +186,10 @@ def after_update(
@classmethod
def after_delete(
cls,
mapper: Mapper,
_mapper: Mapper,
connection: Connection,
target: Union["Dashboard", "FavStar", "Slice"],
) -> None:
# pylint: disable=unused-argument
session = Session(bind=connection)

# delete row from `tagged_objects`
Expand Down Expand Up @@ -234,9 +231,8 @@ def get_owners_ids(cls, target: "Query") -> List[int]:
class FavStarUpdater:
@classmethod
def after_insert(
cls, mapper: Mapper, connection: Connection, target: "FavStar"
cls, _mapper: Mapper, connection: Connection, target: "FavStar"
) -> None:
# pylint: disable=unused-argument
session = Session(bind=connection)
name = "favorited_by:{0}".format(target.user_id)
tag = get_tag(name, session, TagTypes.favorited_by)
Expand All @@ -251,9 +247,8 @@ def after_insert(

@classmethod
def after_delete(
cls, mapper: Mapper, connection: Connection, target: "FavStar"
cls, _mapper: Mapper, connection: Connection, target: "FavStar"
) -> None:
# pylint: disable=unused-argument
session = Session(bind=connection)
name = "favorited_by:{0}".format(target.user_id)
query = (
Expand Down

0 comments on commit 92dd257

Please sign in to comment.