blag commented on a change in pull request #19099:
URL: https://github.com/apache/airflow/pull/19099#discussion_r733007287
##########
File path: tests/providers/amazon/aws/utils/eks_test_constants.py
##########
@@ -198,38 +198,41 @@ class RegExTemplates:
"""The compiled RegEx patterns used in testing."""
CLUSTER_ARN: Pattern = re.compile(
- "arn:"
- + "(?P<partition>.+):"
- + "eks:"
- + "(?P<region>[-0-9a-zA-Z]+):"
- + "(?P<account_id>[0-9]{12}):"
- + "cluster/"
- + "(?P<cluster_name>.+)"
+ r"""arn:
+ (?P<partition>.+):
+ eks:
+ (?P<region>[-0-9a-zA-Z]+):
+ (?P<account_id>[0-9]{12}):
+ cluster/
+ (?P<cluster_name>.+)""",
+ re.VERBOSE,
)
FARGATE_PROFILE_ARN: Pattern = re.compile(
- "arn:"
- + "(?P<partition>.+):"
- + "eks:"
- + "(?P<region>[-0-9a-zA-Z]+):"
- + "(?P<account_id>[0-9]{12}):"
- + "fargateprofile/"
- + "(?P<cluster_name>.+)/"
- + "(?P<fargate_name>.+)/"
- + FARGATE_PROFILE_UUID_PATTERN
+ r"""arn:
+ (?P<partition>.+):
+ eks:
+ (?P<region>[-0-9a-zA-Z]+):
+ (?P<account_id>[0-9]{12}):
+ fargateprofile/
+ (?P<cluster_name>.+)/
+ (?P<fargate_name>.+)/"""
+ + FARGATE_PROFILE_UUID_PATTERN,
+ re.VERBOSE,
)
NODEGROUP_ARN: Pattern = re.compile(
- "arn:"
- + "(?P<partition>.+):"
- + "eks:"
- + "(?P<region>[-0-9a-zA-Z]+):"
- + "(?P<account_id>[0-9]{12}):"
- + "nodegroup/"
- + "(?P<cluster_name>.+)/"
- + "(?P<nodegroup_name>.+)/"
- + NODEGROUP_UUID_PATTERN
+ r"""arn:
+ (?P<partition>.+):
+ eks:
+ (?P<region>[-0-9a-zA-Z]+):
+ (?P<account_id>[0-9]{12}):
+ nodegroup/
+ (?P<cluster_name>.+)/
+ (?P<nodegroup_name>.+)/"""
+ + NODEGROUP_UUID_PATTERN,
+ re.VERBOSE,
)
- NODEGROUP_ASG_NAME_PATTERN: Pattern = re.compile("eks-" +
NODEGROUP_UUID_PATTERN)
- NODEGROUP_SECURITY_GROUP_NAME_PATTERN: Pattern = re.compile("sg-" +
"([-0-9a-z]{17})")
+ NODEGROUP_ASG_NAME_PATTERN: Pattern =
re.compile(f"eks-{NODEGROUP_UUID_PATTERN}")
+ NODEGROUP_SECURITY_GROUP_NAME_PATTERN: Pattern =
re.compile("sg-([-0-9a-z]{17})")
Review comment:
True, I was attempting to minimize the scope of my changes, and I didn't
want to change the way those strings were processed, but getting regex syntax
highlighting with raw strings is very nice.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]