This is an automated email from the ASF dual-hosted git repository.
potiuk 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 a1d4a20548 E731: replace lambda by a def method in Airflow core
(#33758)
a1d4a20548 is described below
commit a1d4a20548b18721aa7564a1e415ff866db2bebd
Author: Hussein Awala <[email protected]>
AuthorDate: Sat Aug 26 09:14:17 2023 +0200
E731: replace lambda by a def method in Airflow core (#33758)
---
airflow/cli/cli_config.py | 5 ++++-
airflow/cli/commands/connection_command.py | 5 ++++-
airflow/www/views.py | 10 ++++++++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/airflow/cli/cli_config.py b/airflow/cli/cli_config.py
index c06bd32d96..c52dd9aa90 100644
--- a/airflow/cli/cli_config.py
+++ b/airflow/cli/cli_config.py
@@ -103,7 +103,10 @@ class Arg:
"""Add this argument to an ArgumentParser."""
if "metavar" in self.kwargs and "type" not in self.kwargs:
if self.kwargs["metavar"] == "DIRPATH":
- type = lambda x: self._is_valid_directory(parser, x)
+
+ def type(x):
+ return self._is_valid_directory(parser, x)
+
self.kwargs["type"] = type
parser.add_argument(*self.flags, **self.kwargs)
diff --git a/airflow/cli/commands/connection_command.py
b/airflow/cli/commands/connection_command.py
index e32abda1f8..fe9e71733c 100644
--- a/airflow/cli/commands/connection_command.py
+++ b/airflow/cli/commands/connection_command.py
@@ -114,7 +114,10 @@ def create_default_connections(args):
def _format_connections(conns: list[Connection], file_format: str,
serialization_format: str) -> str:
if serialization_format == "json":
- serializer_func = lambda x: json.dumps(_connection_to_dict(x))
+
+ def serializer_func(x):
+ return json.dumps(_connection_to_dict(x))
+
elif serialization_format == "uri":
serializer_func = Connection.get_uri
else:
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 353ce14f23..60e0c03263 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -319,9 +319,15 @@ def dag_to_grid(dag: DagModel, dag_runs: Sequence[DagRun],
session: Session):
sort_order = conf.get("webserver", "grid_view_sorting_order",
fallback="topological")
if sort_order == "topological":
- sort_children_fn = lambda task_group: task_group.topological_sort()
+
+ def sort_children_fn(task_group):
+ return task_group.topological_sort()
+
elif sort_order == "hierarchical_alphabetical":
- sort_children_fn = lambda task_group:
task_group.hierarchical_alphabetical_sort()
+
+ def sort_children_fn(task_group):
+ return task_group.hierarchical_alphabetical_sort()
+
else:
raise AirflowConfigException(f"Unsupported grid_view_sorting_order:
{sort_order}")