This is an automated email from the ASF dual-hosted git repository.

shahar1 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 850466814ba Remove unused SDK variable result converter (#75766)
850466814ba is described below

commit 850466814ba91424521ac4dd9d37acf29cddf875
Author: Hussein Awala <[email protected]>
AuthorDate: Tue Oct 27 21:58:02 2026 +0100

    Remove unused SDK variable result converter (#75766)
---
 task-sdk/src/airflow/sdk/execution_time/context.py | 12 ----------
 .../tests/task_sdk/execution_time/test_context.py  | 27 ----------------------
 2 files changed, 39 deletions(-)

diff --git a/task-sdk/src/airflow/sdk/execution_time/context.py 
b/task-sdk/src/airflow/sdk/execution_time/context.py
index b7e69b41a4f..5e5fcc93ee9 100644
--- a/task-sdk/src/airflow/sdk/execution_time/context.py
+++ b/task-sdk/src/airflow/sdk/execution_time/context.py
@@ -92,7 +92,6 @@ if TYPE_CHECKING:
 
     from pydantic.types import JsonValue
 
-    from airflow.sdk import Variable
     from airflow.sdk._shared.state import TaskScope
     from airflow.sdk.bases.operator import BaseOperator
     from airflow.sdk.definitions.connection import Connection
@@ -105,7 +104,6 @@ if TYPE_CHECKING:
         ConnectionResult,
         OKResponse,
         ReceiveMsgType,
-        VariableResult,
     )
     from airflow.sdk.state import BaseStoreBackend
     from airflow.sdk.types import OutletEventAccessorsProtocol
@@ -200,16 +198,6 @@ async def _amask_connection_secrets(conn: Connection) -> 
None:
         await amask_secret(conn.extra)
 
 
-def _convert_variable_result_to_variable(var_result: VariableResult, 
deserialize_json: bool) -> Variable:
-    from airflow.sdk.definitions.variable import Variable
-
-    if deserialize_json:
-        import json
-
-        var_result.value = json.loads(var_result.value)  # type: ignore
-    return Variable(**var_result.model_dump(exclude={"type"}))
-
-
 _preset_connections: ContextVar[dict[str, Connection] | None] = ContextVar(
     "_preset_connections", default=None
 )
diff --git a/task-sdk/tests/task_sdk/execution_time/test_context.py 
b/task-sdk/tests/task_sdk/execution_time/test_context.py
index 0f0cc999173..b48f1eb4d79 100644
--- a/task-sdk/tests/task_sdk/execution_time/test_context.py
+++ b/task-sdk/tests/task_sdk/execution_time/test_context.py
@@ -45,7 +45,6 @@ from airflow.sdk.definitions.asset import (
     AssetUriRef,
 )
 from airflow.sdk.definitions.connection import Connection
-from airflow.sdk.definitions.variable import Variable
 from airflow.sdk.exceptions import (
     AirflowNotFoundException,
     AirflowRuntimeError,
@@ -109,7 +108,6 @@ from airflow.sdk.execution_time.context import (
     _async_get_variable,
     _async_get_variable_keys,
     _async_set_variable,
-    _convert_variable_result_to_variable,
     _get_connection,
     _process_connection_result_conn,
     _wrap_external_ref,
@@ -151,31 +149,6 @@ def test_convert_connection_result_conn():
     )
 
 
-def test_convert_variable_result_to_variable():
-    """Test that the VariableResult is converted to a Variable object."""
-    var = VariableResult(
-        key="test_key",
-        value="test_value",
-    )
-    var = _convert_variable_result_to_variable(var, deserialize_json=False)
-    assert var == Variable(
-        key="test_key",
-        value="test_value",
-    )
-
-
-def test_convert_variable_result_to_variable_with_deserialize_json():
-    """Test that the VariableResult is converted to a Variable object with 
deserialize_json set to True."""
-    var = VariableResult(
-        key="test_key",
-        value='{\r\n  "key1": "value1",\r\n  "key2": "value2",\r\n  "enabled": 
true,\r\n  "threshold": 42\r\n}',
-    )
-    var = _convert_variable_result_to_variable(var, deserialize_json=True)
-    assert var == Variable(
-        key="test_key", value={"key1": "value1", "key2": "value2", "enabled": 
True, "threshold": 42}
-    )
-
-
 class TestAirflowContextHelpers:
     def test_context_to_airflow_vars_empty_context(self):
         assert context_to_airflow_vars({}) == {}

Reply via email to