Skip to content

Commit 1bf2889

Browse files
committed
reorders imports and adds annotations custom_aws_supplier.py
1 parent 02495c1 commit 1bf2889

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

auth/cloud-client-temp/custom_aws_supplier.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import boto3
1919
from dotenv import load_dotenv
20-
from google.auth.aws import Credentials as AwsCredentials
2120
from google.auth.aws import AwsSecurityCredentials, AwsSecurityCredentialsSupplier
21+
from google.auth.aws import Credentials as AwsCredentials
2222
from google.auth.exceptions import GoogleAuthError
2323
from google.auth.transport.requests import AuthorizedSession
2424

@@ -28,7 +28,7 @@
2828
class CustomAwsSupplier(AwsSecurityCredentialsSupplier):
2929
"""Custom AWS Security Credentials Supplier."""
3030

31-
def __init__(self):
31+
def __init__(self) -> None:
3232
"""Initializes the Boto3 session, prioritizing environment variables for region."""
3333
# Explicitly read the region from the environment first. This ensures that
3434
# a value from a .env file is picked up reliably for local testing.
@@ -39,7 +39,7 @@ def __init__(self):
3939
self._cached_region = None
4040
print(f"[INFO] CustomAwsSupplier initialized. Region from env: {region}")
4141

42-
def get_aws_region(self, context, request) -> str:
42+
def get_aws_region(self, context: object, request: object) -> str:
4343
"""Returns the AWS region using Boto3's default provider chain."""
4444
if self._cached_region:
4545
return self._cached_region
@@ -55,7 +55,7 @@ def get_aws_region(self, context, request) -> str:
5555
print(f"[INFO] Boto3 resolved AWS Region: {self._cached_region}")
5656
return self._cached_region
5757

58-
def get_aws_security_credentials(self, context, request=None) -> AwsSecurityCredentials:
58+
def get_aws_security_credentials(self, context: object, request: object = None) -> AwsSecurityCredentials:
5959
"""Retrieves AWS security credentials using Boto3's default provider chain."""
6060
aws_credentials = self.session.get_credentials()
6161
if not aws_credentials:
@@ -71,7 +71,7 @@ def get_aws_security_credentials(self, context, request=None) -> AwsSecurityCred
7171
)
7272

7373

74-
def main():
74+
def main() -> None:
7575
"""Main function to demonstrate the custom AWS supplier."""
7676
print("--- Starting Script ---")
7777

0 commit comments

Comments
 (0)