Skip to content

Commit

Permalink
Use Tuple instead of tuple for typing
Browse files Browse the repository at this point in the history
Signed-off-by: Mynhardt Burger <[email protected]>
  • Loading branch information
mynhardtburger committed Aug 1, 2024
1 parent 9393975 commit 3fe4942
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions caikit_tgis_backend/tgis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Standard
from copy import deepcopy
from threading import Lock
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, Optional, Tuple, Union

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

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

@classmethod
def _request_metadata_get(
cls, metadata: tuple[str, Union[str, bytes]], key: str
cls, metadata: Tuple[str, Union[str, bytes]], key: str
) -> Optional[str]:
"""
Returns the first matching value for the metadata key (case insensitive).
Expand Down
4 changes: 2 additions & 2 deletions tests/test_tgis_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Standard
from copy import deepcopy
from dataclasses import asdict
from typing import Any, Dict, Optional, Sequence, Union
from typing import Any, Dict, Optional, Sequence, Tuple, Union
from unittest import mock
import os
import tempfile
Expand Down Expand Up @@ -105,7 +105,7 @@ class TestServicerContext(grpc.ServicerContext):
def __init__(self, metadata: Dict[str, Union[str, bytes]]):
self.metadata = metadata

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

Expand Down

0 comments on commit 3fe4942

Please sign in to comment.