You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/09/03 17:36:27 UTC

[GitHub] [incubator-superset] serenajiang commented on a change in pull request #8138: [typing] add typing for superset/connectors and superset/common

serenajiang commented on a change in pull request #8138: [typing] add typing for superset/connectors and superset/common
URL: https://github.com/apache/incubator-superset/pull/8138#discussion_r320393779
 
 

 ##########
 File path: superset/connectors/druid/models.py
 ##########
 @@ -146,53 +151,53 @@ def __html__(self):
         return self.__repr__()
 
     @property
-    def data(self):
+    def data(self) -> Dict:
         return {"id": self.id, "name": self.cluster_name, "backend": "druid"}
 
     @staticmethod
-    def get_base_url(host, port):
+    def get_base_url(host, port) -> str:
         if not re.match("http(s)?://", host):
             host = "http://" + host
 
         url = "{0}:{1}".format(host, port) if port else host
         return url
 
-    def get_base_broker_url(self):
+    def get_base_broker_url(self) -> str:
         base_url = self.get_base_url(self.broker_host, self.broker_port)
         return f"{base_url}/{self.broker_endpoint}"
 
-    def get_pydruid_client(self):
+    def get_pydruid_client(self) -> PyDruid:
         cli = PyDruid(
             self.get_base_url(self.broker_host, self.broker_port), self.broker_endpoint
         )
         if self.broker_user and self.broker_pass:
             cli.set_basic_auth_credentials(self.broker_user, self.broker_pass)
         return cli
 
-    def get_datasources(self):
+    def get_datasources(self) -> List[Dict]:
         endpoint = self.get_base_broker_url() + "/datasources"
         auth = requests.auth.HTTPBasicAuth(self.broker_user, self.broker_pass)
         return json.loads(requests.get(endpoint, auth=auth).text)
 
-    def get_druid_version(self):
+    def get_druid_version(self) -> str:
         endpoint = self.get_base_url(self.broker_host, self.broker_port) + "/status"
         auth = requests.auth.HTTPBasicAuth(self.broker_user, self.broker_pass)
         return json.loads(requests.get(endpoint, auth=auth).text)["version"]
 
-    @property
+    @property  # noqa
 
 Review comment:
   My bad - I was using `mypy` instead of `flake8` to find typing errors, thinking they did the same thing. `mypy` seems to be a bit stricter, and it thought this line was an error even though it passed `flake8`, so I removed the unnecessary `# noqa`s that I had put in.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org