diff --git a/aws_lambda_powertools/utilities/batch/types.py b/aws_lambda_powertools/utilities/batch/types.py index 89a5e4e3486..4b07dab51a5 100644 --- a/aws_lambda_powertools/utilities/batch/types.py +++ b/aws_lambda_powertools/utilities/batch/types.py @@ -11,11 +11,10 @@ # For IntelliSense and Mypy to work, we need to account for possible SQS subclasses # We need them as subclasses as we must access their message ID or sequence number metadata via dot notation if has_pydantic: - from aws_lambda_powertools.utilities.parser.models import DynamoDBStreamRecordModel + from aws_lambda_powertools.utilities.parser.models import DynamoDBStreamRecordModel, SqsRecordModel from aws_lambda_powertools.utilities.parser.models import ( KinesisDataStreamRecord as KinesisDataStreamRecordModel, ) - from aws_lambda_powertools.utilities.parser.models import SqsRecordModel BatchTypeModels = Optional[ Union[Type[SqsRecordModel], Type[DynamoDBStreamRecordModel], Type[KinesisDataStreamRecordModel]] diff --git a/aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py b/aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py index 5fcc3039ec6..295f869dc3e 100644 --- a/aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py +++ b/aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py @@ -247,7 +247,7 @@ def _put_record(self, data_record: DataRecord) -> None: def _update_record(self, data_record: DataRecord): logger.debug(f"Updating record for idempotency key: {data_record.idempotency_key}") - update_expression = "SET #response_data = :response_data, #expiry = :expiry, " "#status = :status" + update_expression = "SET #response_data = :response_data, #expiry = :expiry, #status = :status" expression_attr_values: Dict[str, "AttributeValueTypeDef"] = { ":expiry": {"N": str(data_record.expiry_timestamp)}, ":response_data": {"S": data_record.response_data}, diff --git a/aws_lambda_powertools/utilities/parser/models/sns.py b/aws_lambda_powertools/utilities/parser/models/sns.py index 4666d1c4ff2..6cd2fcec006 100644 --- a/aws_lambda_powertools/utilities/parser/models/sns.py +++ b/aws_lambda_powertools/utilities/parser/models/sns.py @@ -1,7 +1,6 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Union from typing import Type as TypingType -from typing import Union from pydantic import BaseModel, root_validator from pydantic.networks import HttpUrl diff --git a/examples/parameters/tests/test_clear_cache_global.py b/examples/parameters/tests/test_clear_cache_global.py index 75087e158d4..27457889ee9 100644 --- a/examples/parameters/tests/test_clear_cache_global.py +++ b/examples/parameters/tests/test_clear_cache_global.py @@ -1,5 +1,4 @@ import pytest - from src import app from aws_lambda_powertools.utilities import parameters diff --git a/examples/parameters/tests/test_clear_cache_method.py b/examples/parameters/tests/test_clear_cache_method.py index c59ea202f8d..0d590a3938c 100644 --- a/examples/parameters/tests/test_clear_cache_method.py +++ b/examples/parameters/tests/test_clear_cache_method.py @@ -1,5 +1,4 @@ import pytest - from src import app diff --git a/examples/parameters/tests/test_with_fixture.py b/examples/parameters/tests/test_with_fixture.py index 487f739e8eb..7ac71057e0b 100644 --- a/examples/parameters/tests/test_with_fixture.py +++ b/examples/parameters/tests/test_with_fixture.py @@ -1,5 +1,4 @@ import pytest - from src import single_mock diff --git a/ruff.toml b/ruff.toml index 3ed70837a33..04d8c503804 100644 --- a/ruff.toml +++ b/ruff.toml @@ -34,10 +34,7 @@ ignore = [ "PLR2004", #https://beta.ruff.rs/docs/rules/magic-value-comparison/ "PLW0603", #https://beta.ruff.rs/docs/rules/global-statement/ "B904", # raise-without-from-inside-except - disabled temporarily - "B018", # useless-expression - disabled temporarily "PLC1901", # Compare-to-empty-string - disabled temporarily - "ISC", # flake8-implicit-str-concat - disabled temporarily - "I001", # isort - disabled temporarily ] # Exclude files and directories diff --git a/tests/functional/idempotency/conftest.py b/tests/functional/idempotency/conftest.py index 5dda24b9460..9bacfb58779 100644 --- a/tests/functional/idempotency/conftest.py +++ b/tests/functional/idempotency/conftest.py @@ -91,7 +91,7 @@ def expected_params_update_item(serialized_lambda_response, hashed_idempotency_k }, "Key": {"id": {"S": hashed_idempotency_key}}, "TableName": "TEST_TABLE", - "UpdateExpression": "SET #response_data = :response_data, " "#expiry = :expiry, #status = :status", + "UpdateExpression": "SET #response_data = :response_data, #expiry = :expiry, #status = :status", } diff --git a/tests/functional/idempotency/utils.py b/tests/functional/idempotency/utils.py index d12f1dbba1e..bf57259fe76 100644 --- a/tests/functional/idempotency/utils.py +++ b/tests/functional/idempotency/utils.py @@ -72,5 +72,5 @@ def build_idempotency_update_item_stub( }, "Key": {"id": {"S": idempotency_key_hash}}, "TableName": "TEST_TABLE", - "UpdateExpression": "SET #response_data = :response_data, " "#expiry = :expiry, #status = :status", + "UpdateExpression": "SET #response_data = :response_data, #expiry = :expiry, #status = :status", } diff --git a/tests/unit/data_classes/test_code_pipeline_job_event.py b/tests/unit/data_classes/test_code_pipeline_job_event.py index 3ce681f3ffd..a1689ede2f1 100644 --- a/tests/unit/data_classes/test_code_pipeline_job_event.py +++ b/tests/unit/data_classes/test_code_pipeline_job_event.py @@ -105,7 +105,7 @@ def test_code_pipeline_event_non_json_user_parameters(): assert configuration.user_parameters is not None with pytest.raises(json.decoder.JSONDecodeError): - configuration.decoded_user_parameters + assert configuration.decoded_user_parameters is not None def test_code_pipeline_event_decoded_data(): diff --git a/tests/unit/test_data_classes.py b/tests/unit/test_data_classes.py index fa04975f91c..c810f653f5b 100644 --- a/tests/unit/test_data_classes.py +++ b/tests/unit/test_data_classes.py @@ -180,7 +180,7 @@ def data_property(self) -> list: event_source = DataClassSample({}) event_str = ( "{'data_property': ['string', 0, 0.0, {'broken_data_property': " - + "'[Cannot be deserialized]', 'raw_event': '[SENSITIVE]'}], 'raw_event': '[SENSITIVE]'}" + "'[Cannot be deserialized]', 'raw_event': '[SENSITIVE]'}], 'raw_event': '[SENSITIVE]'}" ) assert str(event_source) == event_str @@ -213,9 +213,8 @@ def data_property(self) -> DataClassTerminal: event_source = DataClassRecursive({}) assert ( - str(event_source) - == "{'data_property': {'raw_event': '[SENSITIVE]', 'terminal_property': 'end-recursion'}," - + " 'raw_event': '[SENSITIVE]'}" + str(event_source) == "{'data_property': {'raw_event': '[SENSITIVE]', 'terminal_property': 'end-recursion'}," + " 'raw_event': '[SENSITIVE]'}" )