Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pylint rules enabled in models #11037

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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