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



##########
File path: superset/utils/core.py
##########
@@ -985,11 +988,11 @@ def is_adhoc_metric(metric) -> bool:
     )
 
 
-def get_metric_name(metric):
-    return metric["label"] if is_adhoc_metric(metric) else metric
+def get_metric_name(metric: Metric) -> str:

Review comment:
       I agree.

##########
File path: superset/typing.py
##########
@@ -16,15 +16,31 @@
 # under the License.
 from typing import Any, Callable, Dict, List, Optional, Tuple, Union
 
-from flask import Flask
+import flask
+import werkzeug
 from flask_caching import Cache
 
-CacheConfig = Union[Callable[[Flask], Cache], Dict[str, Any]]
+CacheConfig = Union[Callable[[flask.Flask], Cache], Dict[str, Any]]
 DbapiDescriptionRow = Tuple[
     str, str, Optional[str], Optional[str], Optional[int], Optional[int], bool
 ]
 DbapiDescription = Union[List[DbapiDescriptionRow], Tuple[DbapiDescriptionRow, 
...]]
 DbapiResult = List[Union[List[Any], Tuple[Any, ...]]]
 FilterValue = Union[float, int, str]
 FilterValues = Union[FilterValue, List[FilterValue], Tuple[FilterValue]]
+Granularity = Union[str, Dict[str, Union[str, float]]]
+Metric = Union[Dict[str, str], str]
+QueryObjectDict = Dict[str, Any]
 VizData = Optional[Union[List[Any], Dict[Any, Any]]]
+
+# Flask response.
+Base = Union[bytes, str]
+Status = Union[int, str]
+Headers = Dict[str, Any]
+FlaskResponse = Union[
+    flask.wrappers.Response,
+    werkzeug.wrappers.Response,
+    Base,
+    Union[Base, Status],
+    Union[Base, Status, Headers],
+]

Review comment:
       As we already have a wrapping `Union` here, couldn't this be expressed 
as `Union[..., Base, Status, Headers]`?




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