|
17 | 17 | This is used by gapic clients to provide common error mapping, retry, timeout, |
18 | 18 | compression, pagination, and long-running operations to gRPC methods. |
19 | 19 | """ |
20 | | -from typing import Tuple, List |
| 20 | + |
21 | 21 | import enum |
22 | 22 | import functools |
| 23 | +from typing import List, Tuple |
23 | 24 |
|
24 | 25 | from google.api_core import grpc_helpers |
25 | 26 | from google.api_core.gapic_v1 import client_info |
@@ -69,7 +70,7 @@ def _extract_metrics_header(metadata) -> Tuple[str, List[Tuple[str, str]]]: |
69 | 70 | - a string representing the header value. |
70 | 71 | """ |
71 | 72 | if not metadata: |
72 | | - return "", () |
| 73 | + return "", [] |
73 | 74 |
|
74 | 75 | key_to_find = client_info.METRICS_METADATA_KEY |
75 | 76 |
|
@@ -122,7 +123,7 @@ def __init__( |
122 | 123 | if x_goog_api_client: |
123 | 124 | self._default_metadata = ( |
124 | 125 | (client_info.METRICS_METADATA_KEY, x_goog_api_client), |
125 | | - *self._static_metadata |
| 126 | + *self._static_metadata, |
126 | 127 | ) |
127 | 128 | else: |
128 | 129 | self._default_metadata = self._static_metadata |
@@ -153,7 +154,9 @@ def __call__( |
153 | 154 | user_x_goog, remaining = _extract_metrics_header(user_metadata) |
154 | 155 | api_client_tokens = [t for t in [user_x_goog, self._x_goog_api_client] if t] |
155 | 156 | if api_client_tokens: |
156 | | - final_metadata.append((client_info.METRICS_METADATA_KEY, " ".join(api_client_tokens))) |
| 157 | + final_metadata.append( |
| 158 | + (client_info.METRICS_METADATA_KEY, " ".join(api_client_tokens)) |
| 159 | + ) |
157 | 160 | final_metadata.extend(remaining) |
158 | 161 | kwargs["metadata"] = final_metadata |
159 | 162 | elif self._default_metadata: |
|
0 commit comments