You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/05/25 22:15:47 UTC
[GitHub] [airflow] o-nikolas commented on a diff in pull request #23907: Light Refactor and Clean-up AWS Provider
o-nikolas commented on code in PR #23907:
URL: https://github.com/apache/airflow/pull/23907#discussion_r882156054
##########
tests/providers/amazon/aws/utils/eks_test_utils.py:
##########
@@ -164,10 +164,14 @@ def region_matches_partition(region: str, partition: str) -> bool:
("us-gov-iso-b-", "aws-iso-b"),
]
- for prefix, expected_partition in valid_matches:
- if region.startswith(prefix):
- return partition == expected_partition
- return partition == "aws"
+ return next(
+ (
+ partition == expected_partition
+ for prefix, expected_partition in valid_matches
+ if region.startswith(prefix)
+ ),
+ partition == "aws",
+ )
Review Comment:
Nit: Defining a generator inline and calling next with the default is fun Python but I think it is a bit unnecessary, it's turning 4 lines of very readable code into 8 lines of obtuse Python.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org