Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
run pre-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed Jan 18, 2024
1 parent 865975c commit 9b6cd9b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions prefect_aws/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def get_client(self, client_type: Union[str, ClientType], use_cache: bool = Fals
if not use_cache:
return self.get_boto3_session().client(
service_name=client_type,
**self.aws_client_parameters.get_params_override()
**self.aws_client_parameters.get_params_override(),
)

return _get_client_cached(ctx=self, client_type=client_type)

def get_s3_client(self) -> S3Client:
Expand Down Expand Up @@ -299,9 +299,9 @@ def get_client(self, client_type: Union[str, ClientType], use_cache: bool = Fals
if not use_cache:
return self.get_boto3_session().client(
service_name=client_type,
**self.aws_client_parameters.get_params_override()
**self.aws_client_parameters.get_params_override(),
)

return _get_client_cached(ctx=self, client_type=client_type)

def get_s3_client(self) -> S3Client:
Expand Down
2 changes: 1 addition & 1 deletion prefect_aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class S3Bucket(WritableFileSystem, WritableDeploymentStorage, ObjectStorageBlock
"for reading and writing objects."
),
)

cache_client: bool = Field(
default=False,
description=(
Expand Down
9 changes: 4 additions & 5 deletions tests/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ def test_credentials_get_client(credentials, client_type):
with mock_s3():
assert isinstance(credentials.get_client(client_type), BaseClient)

@pytest.mark.parametrize(
"client_type", [member.value for member in ClientType]
)

@pytest.mark.parametrize("client_type", [member.value for member in ClientType])
def test_get_client_cached(client_type):
"""
Test to ensure that _get_client_cached function returns the same instance
Expand All @@ -68,7 +67,7 @@ def test_get_client_cached(client_type):
assert _get_client_cached.cache_info().hits == 0, "Initial call count should be 0"

assert aws_credentials_block.get_client(client_type) is not None

assert _get_client_cached.cache_info().hits == 0, "Cache should not yet be used"

# Call get_client multiple times with the same parameters
Expand All @@ -78,4 +77,4 @@ def test_get_client_cached(client_type):

# Verify that _get_client_cached is called only once due to caching
assert _get_client_cached.cache_info().misses == 1
assert _get_client_cached.cache_info().hits == 2
assert _get_client_cached.cache_info().hits == 2

0 comments on commit 9b6cd9b

Please sign in to comment.