Skip to content

Commit 3fe4942

Browse files
Use Tuple instead of tuple for typing
Signed-off-by: Mynhardt Burger <Mynhardt.Burger@ibm.com>
1 parent 9393975 commit 3fe4942

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

caikit_tgis_backend/tgis_backend.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Standard
1717
from copy import deepcopy
1818
from threading import Lock
19-
from typing import Any, Dict, Optional, Union
19+
from typing import Any, Dict, Optional, Tuple, Union
2020

2121
# Third Party
2222
import grpc
@@ -431,7 +431,7 @@ def _request_header_get(cls, request: fastapi.Request, key: str) -> Optional[str
431431
If no matching header was found return None.
432432
"""
433433
# https://github.com/encode/starlette/blob/5ed55c441126687106109a3f5e051176f88cd3e6/starlette/datastructures.py#L543
434-
items: list[tuple[str, str]] = request.headers.items()
434+
items: list[Tuple[str, str]] = request.headers.items()
435435
get_header_key = key.lower()
436436

437437
for header_key, header_value in items:
@@ -440,7 +440,7 @@ def _request_header_get(cls, request: fastapi.Request, key: str) -> Optional[str
440440

441441
@classmethod
442442
def _request_metadata_get(
443-
cls, metadata: tuple[str, Union[str, bytes]], key: str
443+
cls, metadata: Tuple[str, Union[str, bytes]], key: str
444444
) -> Optional[str]:
445445
"""
446446
Returns the first matching value for the metadata key (case insensitive).

tests/test_tgis_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Standard
1919
from copy import deepcopy
2020
from dataclasses import asdict
21-
from typing import Any, Dict, Optional, Sequence, Union
21+
from typing import Any, Dict, Optional, Sequence, Tuple, Union
2222
from unittest import mock
2323
import os
2424
import tempfile
@@ -105,7 +105,7 @@ class TestServicerContext(grpc.ServicerContext):
105105
def __init__(self, metadata: Dict[str, Union[str, bytes]]):
106106
self.metadata = metadata
107107

108-
def invocation_metadata(self) -> Sequence[tuple[str, Union[str, bytes]]]:
108+
def invocation_metadata(self) -> Sequence[Tuple[str, Union[str, bytes]]]:
109109
# https://grpc.github.io/grpc/python/glossary.html#term-metadata
110110
return list(self.metadata.items())
111111

0 commit comments

Comments
 (0)