You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ur...@apache.org on 2023/09/11 01:55:58 UTC
[airflow] branch main updated: Change "not all" to "any" for ease of readability (#34259)
This is an automated email from the ASF dual-hosted git repository.
uranusjr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 21ac3b92d2 Change "not all" to "any" for ease of readability (#34259)
21ac3b92d2 is described below
commit 21ac3b92d2213b631c918f851974701fa5d55956
Author: Pankaj Koti <pa...@gmail.com>
AuthorDate: Mon Sep 11 07:25:51 2023 +0530
Change "not all" to "any" for ease of readability (#34259)
---
airflow/metrics/validators.py | 2 +-
airflow/utils/setup_teardown.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/airflow/metrics/validators.py b/airflow/metrics/validators.py
index 501229578d..7f0bbac218 100644
--- a/airflow/metrics/validators.py
+++ b/airflow/metrics/validators.py
@@ -178,7 +178,7 @@ def stat_name_default_handler(
raise InvalidStatsNameException(
f"The stat_name ({stat_name}) has to be less than {max_length} characters."
)
- if not all((c in allowed_chars) for c in stat_name):
+ if any(c not in allowed_chars for c in stat_name):
raise InvalidStatsNameException(
f"The stat name ({stat_name}) has to be composed of ASCII "
f"alphabets, numbers, or the underscore, dot, or dash characters."
diff --git a/airflow/utils/setup_teardown.py b/airflow/utils/setup_teardown.py
index f1de3b4092..c61bc4c4a1 100644
--- a/airflow/utils/setup_teardown.py
+++ b/airflow/utils/setup_teardown.py
@@ -168,7 +168,7 @@ class BaseSetupTeardownContext:
@classmethod
def _push_tasks(cls, operator: AbstractOperator | list[AbstractOperator], setup: bool = False):
if isinstance(operator, list):
- if not all(task.is_setup == operator[0].is_setup for task in operator):
+ if any(task.is_setup != operator[0].is_setup for task in operator):
cls.error("All tasks in the list must be either setup or teardown tasks")
if setup:
cls.push_context_managed_setup_task(operator)