villebro commented on a change in pull request #9912:
URL: 
https://github.com/apache/incubator-superset/pull/9912#discussion_r430870296



##########
File path: superset/views/chart/views.py
##########
@@ -40,22 +41,22 @@ class SliceModelView(
         RouteMethod.API_DELETE,
     }
 
-    def pre_add(self, item):
+    def pre_add(self, item: "SliceModelView") -> None:
         utils.validate_json(item.params)
 
-    def pre_update(self, item):
+    def pre_update(self, item: "SliceModelView") -> None:
         utils.validate_json(item.params)
         check_ownership(item)
 
-    def pre_delete(self, item):
+    def pre_delete(self, item: "SliceModelView") -> None:
         check_ownership(item)
 
     @expose("/add", methods=["GET", "POST"])
     @has_access
-    def add(self):
-        datasources = ConnectorRegistry.get_all_datasources(db.session)
+    def add(self) -> FlaskResponse:
         datasources = [
-            {"value": str(d.id) + "__" + d.type, "label": repr(d)} for d in 
datasources
+            {"value": str(d.id) + "__" + str(d.type), "label": repr(d)}

Review comment:
       I think we can treat `d.type` as being an abstract property that is 
always set. Couldn't we just change that to be `type: str`, or optionally make 
it
   ```
   @property
   def type(self) -> str:
       raise NotImplementedError()
   ```




----------------------------------------------------------------
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.

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