bito-code-review[bot] commented on code in PR #42339:
URL: https://github.com/apache/superset/pull/42339#discussion_r3772052331
##########
superset/commands/tag/export.py:
##########
@@ -23,33 +23,56 @@
import yaml
from superset.daos.chart import ChartDAO
from superset.daos.dashboard import DashboardDAO
+from superset.daos.tag import TagDAO
from superset.extensions import feature_flag_manager
from superset.tags.models import TagType
+from superset.commands.export.models import ExportModelsCommand
from superset.commands.tag.exceptions import TagNotFoundError
-# pylint: disable=too-few-public-methods
-class ExportTagsCommand:
+class ExportTagsCommand(ExportModelsCommand):
+ dao = TagDAO
not_found = TagNotFoundError
+ def __init__(
+ self,
+ model_ids: Optional[list[int]] = None,
+ export_related: bool = True,
+ *,
+ dashboard_ids: Optional[Union[int, List[Union[int, str]]]] = None,
+ chart_ids: Optional[Union[int, List[Union[int, str]]]] = None,
+ ):
+ self.model_ids = model_ids or []
+ self.export_related = export_related
+ self.dashboard_ids = dashboard_ids
+ self.chart_ids = chart_ids
Review Comment:
<!-- Bito Reply -->
The implementation correctly maintains the parent class contract by
initializing `self.model_ids` as a list, ensuring compatibility with the
expected `list[int]` type. Since `ExportTagsCommand` inherits from
`ExportModelsCommand` and does not override `validate()`, the parent's
`validate()` method will still execute `self.dao.find_by_ids(self.model_ids)`
as intended, preserving the existing error handling behavior.
**superset/commands/tag/export.py**
```
def __init__(
self,
model_ids: Optional[list[int]] = None,
export_related: bool = True,
*,
dashboard_ids: Optional[Union[int, List[Union[int, str]]]] = None,
chart_ids: Optional[Union[int, List[Union[int, str]]]] = None,
):
self.model_ids = model_ids or []
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]