diff --git a/airflow/api_connexion/endpoints/dag_source_endpoint.py b/airflow/api_connexion/endpoints/dag_source_endpoint.py index 42ccd4e5d8671..b191630815004 100644 --- a/airflow/api_connexion/endpoints/dag_source_endpoint.py +++ b/airflow/api_connexion/endpoints/dag_source_endpoint.py @@ -43,6 +43,6 @@ def get_dag_source(*, file_token: str) -> Response: if return_type == "text/plain": return Response(dag_source, headers={"Content-Type": return_type}) if return_type == "application/json": - content = dag_source_schema.dumps(dict(content=dag_source)) + content = dag_source_schema.dumps({"content": dag_source}) return Response(content, headers={"Content-Type": return_type}) return Response("Not Allowed Accept Header", status=HTTPStatus.NOT_ACCEPTABLE) diff --git a/airflow/api_connexion/schemas/dag_schema.py b/airflow/api_connexion/schemas/dag_schema.py index 08f649b3d699f..9c063cb93729a 100644 --- a/airflow/api_connexion/schemas/dag_schema.py +++ b/airflow/api_connexion/schemas/dag_schema.py @@ -120,7 +120,7 @@ def get_tags(obj: DAG): """Dump tags as objects.""" tags = obj.tags if tags: - return [DagTagSchema().dump(dict(name=tag)) for tag in tags] + return [DagTagSchema().dump({"name": tag}) for tag in tags] return [] @staticmethod diff --git a/airflow/cli/cli_config.py b/airflow/cli/cli_config.py index c06bd32d96cbb..0d4f3920c575c 100644 --- a/airflow/cli/cli_config.py +++ b/airflow/cli/cli_config.py @@ -2026,7 +2026,7 @@ class GroupCommand(NamedTuple): name="standalone", help="Run an all-in-one copy of Airflow", func=lazy_load_command("airflow.cli.commands.standalone_command.standalone"), - args=tuple(), + args=(), ), ] diff --git a/airflow/cli/commands/connection_command.py b/airflow/cli/commands/connection_command.py index e32abda1f8ae0..166fc0773c6f8 100644 --- a/airflow/cli/commands/connection_command.py +++ b/airflow/cli/commands/connection_command.py @@ -96,16 +96,16 @@ def connections_list(args): def _connection_to_dict(conn: Connection) -> dict: - return dict( - conn_type=conn.conn_type, - description=conn.description, - login=conn.login, - password=conn.password, - host=conn.host, - port=conn.port, - schema=conn.schema, - extra=conn.extra, - ) + return { + "conn_type": conn.conn_type, + "description": conn.description, + "login": conn.login, + "password": conn.password, + "host": conn.host, + "port": conn.port, + "schema": conn.schema, + "extra": conn.extra, + } def create_default_connections(args): diff --git a/airflow/dag_processing/processor.py b/airflow/dag_processing/processor.py index e38bae653c540..ab17bad4dabd5 100644 --- a/airflow/dag_processing/processor.py +++ b/airflow/dag_processing/processor.py @@ -619,7 +619,7 @@ def update_import_errors( for filename, stacktrace in import_errors.items(): if filename in existing_import_error_files: session.query(errors.ImportError).filter(errors.ImportError.filename == filename).update( - dict(filename=filename, timestamp=timezone.utcnow(), stacktrace=stacktrace), + {"filename": filename, "timestamp": timezone.utcnow(), "stacktrace": stacktrace}, synchronize_session="fetch", ) else: diff --git a/airflow/operators/python.py b/airflow/operators/python.py index 85238b4bb3356..ad2deb8ad7069 100644 --- a/airflow/operators/python.py +++ b/airflow/operators/python.py @@ -430,14 +430,14 @@ def _execute_python_callable_in_subprocess(self, python_path: Path, tmp_dir: Pat self._write_args(input_path) self._write_string_args(string_args_path) write_python_script( - jinja_context=dict( - op_args=self.op_args, - op_kwargs=op_kwargs, - expect_airflow=self.expect_airflow, - pickling_library=self.pickling_library.__name__, - python_callable=self.python_callable.__name__, - python_callable_source=self.get_python_source(), - ), + jinja_context={ + "op_args": self.op_args, + "op_kwargs": op_kwargs, + "expect_airflow": self.expect_airflow, + "pickling_library": self.pickling_library.__name__, + "python_callable": self.python_callable.__name__, + "python_callable_source": self.get_python_source(), + }, filename=os.fspath(script_path), render_template_as_native_obj=self.dag.render_template_as_native_obj, ) diff --git a/airflow/serialization/serialized_objects.py b/airflow/serialization/serialized_objects.py index 67d08b7a94fd8..b3a252783a15e 100644 --- a/airflow/serialization/serialized_objects.py +++ b/airflow/serialization/serialized_objects.py @@ -476,7 +476,7 @@ def serialize( elif isinstance(var, XComArg): return cls._encode(serialize_xcom_arg(var), type_=DAT.XCOM_REF) elif isinstance(var, Dataset): - return cls._encode(dict(uri=var.uri, extra=var.extra), type_=DAT.DATASET) + return cls._encode({"uri": var.uri, "extra": var.extra}, type_=DAT.DATASET) elif isinstance(var, SimpleTaskInstance): return cls._encode( cls.serialize(var.__dict__, strict=strict, use_pydantic_models=use_pydantic_models), @@ -616,12 +616,12 @@ def _value_is_hardcoded_default(cls, attrname: str, value: Any, instance: Any) - @classmethod def _serialize_param(cls, param: Param): - return dict( - __class=f"{param.__module__}.{param.__class__.__name__}", - default=cls.serialize(param.value), - description=cls.serialize(param.description), - schema=cls.serialize(param.schema), - ) + return { + "__class": f"{param.__module__}.{param.__class__.__name__}", + "default": cls.serialize(param.value), + "description": cls.serialize(param.description), + "schema": cls.serialize(param.schema), + } @classmethod def _deserialize_param(cls, param_dict: dict): diff --git a/airflow/utils/db_cleanup.py b/airflow/utils/db_cleanup.py index 4c82f90ab3814..f4e0293430d74 100644 --- a/airflow/utils/db_cleanup.py +++ b/airflow/utils/db_cleanup.py @@ -83,13 +83,13 @@ def __lt__(self, other): @property def readable_config(self): - return dict( - table=self.orm_model.name, - recency_column=str(self.recency_column), - keep_last=self.keep_last, - keep_last_filters=[str(x) for x in self.keep_last_filters] if self.keep_last_filters else None, - keep_last_group_by=str(self.keep_last_group_by), - ) + return { + "table": self.orm_model.name, + "recency_column": str(self.recency_column), + "keep_last": self.keep_last, + "keep_last_filters": [str(x) for x in self.keep_last_filters] if self.keep_last_filters else None, + "keep_last_group_by": str(self.keep_last_group_by), + } config_list: list[_TableConfig] = [ diff --git a/airflow/utils/log/secrets_masker.py b/airflow/utils/log/secrets_masker.py index a0f0da847c1b5..bb39dbf95b02b 100644 --- a/airflow/utils/log/secrets_masker.py +++ b/airflow/utils/log/secrets_masker.py @@ -176,7 +176,7 @@ def _record_attrs_to_ignore(self) -> Iterable[str]: __file__, 1, "", - tuple(), + (), exc_info=None, func="funcname", ) diff --git a/airflow/www/extensions/init_manifest_files.py b/airflow/www/extensions/init_manifest_files.py index 2ce60194a60a9..4d491786a81fc 100644 --- a/airflow/www/extensions/init_manifest_files.py +++ b/airflow/www/extensions/init_manifest_files.py @@ -56,4 +56,4 @@ def get_url_for_asset(): static/dist folder. This template tag reads the asset name in ``manifest.json`` and returns the appropriate file. """ - return dict(url_for_asset=get_asset_url) + return {"url_for_asset": get_asset_url}