From d81e8658bac6c4e34ed5a1ee20381e16aff57487 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Mon, 21 Aug 2023 11:48:25 +0200 Subject: [PATCH 1/2] fix(event_handler): fix invalid escape sequence --- aws_lambda_powertools/event_handler/api_gateway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws_lambda_powertools/event_handler/api_gateway.py b/aws_lambda_powertools/event_handler/api_gateway.py index 1e6fe2a50bb..7f86293fb4a 100644 --- a/aws_lambda_powertools/event_handler/api_gateway.py +++ b/aws_lambda_powertools/event_handler/api_gateway.py @@ -43,7 +43,7 @@ _DYNAMIC_ROUTE_PATTERN = r"(<\w+>)" _SAFE_URI = "-._~()'!*:@,;=" # https://www.ietf.org/rfc/rfc3986.txt # API GW/ALB decode non-safe URI chars; we must support them too -_UNSAFE_URI = "%<> \[\]{}|^" # noqa: W605 +_UNSAFE_URI = r"%<> \[\]{}|^" _NAMED_GROUP_BOUNDARY_PATTERN = rf"(?P\1[{_SAFE_URI}{_UNSAFE_URI}\\w]+)" _ROUTE_REGEX = "^{}$" From 0385d603c14a0bf9a9b03f3a454c3c3c4969e6a1 Mon Sep 17 00:00:00 2001 From: Ruben Fonseca Date: Mon, 21 Aug 2023 11:51:40 +0200 Subject: [PATCH 2/2] fix: remove another case of W605 --- tests/unit/data_classes/test_api_gateway_authorizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/data_classes/test_api_gateway_authorizer.py b/tests/unit/data_classes/test_api_gateway_authorizer.py index fe4706596c0..52ce96f84e2 100644 --- a/tests/unit/data_classes/test_api_gateway_authorizer.py +++ b/tests/unit/data_classes/test_api_gateway_authorizer.py @@ -31,7 +31,7 @@ def test_authorizer_response_invalid_verb(builder: APIGatewayAuthorizerResponse) def test_authorizer_response_invalid_resource(builder: APIGatewayAuthorizerResponse): - with pytest.raises(ValueError, match="Invalid resource path: \$."): # noqa: W605 + with pytest.raises(ValueError, match=r"Invalid resource path: \$."): # GIVEN an invalid resource path "$" # WHEN calling deny_method builder.deny_route(http_method=HttpVerb.GET.value, resource="$")