bito-code-review[bot] commented on code in PR #42339:
URL: https://github.com/apache/superset/pull/42339#discussion_r3772491829


##########
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 reviewer's concern regarding the parent contract violation is addressed 
by the implementation. By initializing `self.model_ids` as `model_ids or []` in 
the constructor, the command ensures that `self.model_ids` is always a list, 
satisfying the `list[int]` requirement of the parent class. Since `validate()` 
is inherited and not overridden, it correctly executes 
`self.dao.find_by_ids(self.model_ids)` as expected.
   
   **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]

Reply via email to