-
Notifications
You must be signed in to change notification settings - Fork 16.6k
[mypy] Enforcing typing for superset.dashboards #9418
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
Changes from all commits
67146c4
96cb335
9585392
9962c2c
ac53820
d9e2180
c18dd50
7ab7f96
ce6b62e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,9 +15,7 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| from abc import ABC, abstractmethod | ||
| from typing import Optional | ||
|
|
||
| from flask_appbuilder.models.sqla import Model | ||
| from typing import Any | ||
|
|
||
|
|
||
| class BaseCommand(ABC): | ||
|
|
@@ -26,7 +24,7 @@ class BaseCommand(ABC): | |
| """ | ||
|
|
||
| @abstractmethod | ||
| def run(self) -> Optional[Model]: | ||
| def run(self) -> Any: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @john-bodley I'm setting base has Any, a bit wide, another option could be maintaining |
||
| """ | ||
| Run executes the command. Can raise command exceptions | ||
| :raises: CommandException | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,10 +40,11 @@ def __init__(self, user: User, model_ids: List[int]): | |
| self._model_ids = model_ids | ||
| self._models: Optional[List[Dashboard]] = None | ||
|
|
||
| def run(self): | ||
| def run(self) -> None: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My take is that the abstract is defined has And I'm assuming that the commands succeed and return or raise. What do you think?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the other hand we can make them more coherent and always expect
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the later, i.e., all the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ended up reverting typing on command to a more explicit type, following @villebro comments and reasoning around:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| self.validate() | ||
| try: | ||
| DashboardDAO.bulk_delete(self._models) | ||
| return None | ||
| except DeleteFailedError as e: | ||
| logger.exception(e.exception) | ||
| raise DashboardBulkDeleteFailedError() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.