You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "eumiro (via GitHub)" <gi...@apache.org> on 2023/08/30 19:01:49 UTC
[GitHub] [airflow] eumiro commented on a diff in pull request #33898: Refactor regex in providers
eumiro commented on code in PR #33898:
URL: https://github.com/apache/airflow/pull/33898#discussion_r1310700381
##########
airflow/providers/amazon/aws/utils/__init__.py:
##########
@@ -66,8 +66,8 @@ def datetime_to_epoch_us(date_time: datetime) -> int:
def get_airflow_version() -> tuple[int, ...]:
- val = re.sub(r"(\d+\.\d+\.\d+).*", lambda x: x.group(1), version)
- return tuple(int(x) for x in val.split("."))
+ match = re.match(r"(\d+)\.(\d+)\.(\d+)", version)
Review Comment:
That's the difference between `re.search` (anywhere in the string), `re.match` (at the beginning) and `re.fullmatch` (both beginning and end). You do not have to add `^` at the beginning of a `re.match` pattern.
--
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