etr2460 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_r320497728
########## 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: Got it, can we add this comment instead then to only block certain linting and not all of it on this line? `# type: ignore` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org