Skip to content

Commit

Permalink
Python 3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaspuff committed Jan 29, 2024
1 parent 711da5a commit a65e5ee
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tomodachi/helpers/aws_credentials.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import sys
from typing import Any, ItemsView, Iterator, KeysView, Optional, TypedDict, TypeVar, Union, ValuesView, cast, overload
from typing import (
Any,
Dict,
ItemsView,
Iterator,
KeysView,
Optional,
TypedDict,
TypeVar,
Union,
ValuesView,
cast,
overload,
)

if sys.version_info >= (3, 12):
from typing import Literal
Expand Down Expand Up @@ -43,7 +56,7 @@ def keys(
result = {}
for key in ("region_name", "aws_access_key_id", "aws_secret_access_key", "aws_session_token", "endpoint_url"):
result[key] = ...
return cast(dict[CredentialsTypeKeys, Optional[str]], result).keys()
return cast(Dict[CredentialsTypeKeys, Optional[str]], result).keys()

def dict(self) -> CredentialsDict:
result: CredentialsDict = {}
Expand All @@ -54,12 +67,12 @@ def dict(self) -> CredentialsDict:
def values(
self,
) -> ValuesView[Optional[str]]:
return cast(dict[CredentialsTypeKeys, Optional[str]], self.dict()).values()
return cast(Dict[CredentialsTypeKeys, Optional[str]], self.dict()).values()

def items(
self,
) -> ItemsView[CredentialsTypeKeys, Optional[str]]:
return cast(dict[CredentialsTypeKeys, Optional[str]], self.items()).items()
return cast(Dict[CredentialsTypeKeys, Optional[str]], self.items()).items()

@overload
def __init__(
Expand Down

0 comments on commit a65e5ee

Please sign in to comment.