Skip to content

Commit 2a8be25

Browse files
authored
fix(event_handler): make invalid chars a raw str to fix DeprecationWarning (#2982)
1 parent 8390ecd commit 2a8be25

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
_DYNAMIC_ROUTE_PATTERN = r"(<\w+>)"
4444
_SAFE_URI = "-._~()'!*:@,;=" # https://www.ietf.org/rfc/rfc3986.txt
4545
# API GW/ALB decode non-safe URI chars; we must support them too
46-
_UNSAFE_URI = "%<> \[\]{}|^" # noqa: W605
46+
_UNSAFE_URI = r"%<> \[\]{}|^"
4747
_NAMED_GROUP_BOUNDARY_PATTERN = rf"(?P\1[{_SAFE_URI}{_UNSAFE_URI}\\w]+)"
4848
_ROUTE_REGEX = "^{}$"
4949

tests/unit/data_classes/test_api_gateway_authorizer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_authorizer_response_invalid_verb(builder: APIGatewayAuthorizerResponse)
3131

3232

3333
def test_authorizer_response_invalid_resource(builder: APIGatewayAuthorizerResponse):
34-
with pytest.raises(ValueError, match="Invalid resource path: \$."): # noqa: W605
34+
with pytest.raises(ValueError, match=r"Invalid resource path: \$."):
3535
# GIVEN an invalid resource path "$"
3636
# WHEN calling deny_method
3737
builder.deny_route(http_method=HttpVerb.GET.value, resource="$")

0 commit comments

Comments
 (0)