refactor: make code simpler

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN-
2026-03-18 17:50:18 +08:00
parent 2175ae0e97
commit 5cad0caaae
6 changed files with 23 additions and 23 deletions

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
import importlib
import json
from collections.abc import Mapping, Sequence
from contextlib import AbstractContextManager
from contextlib import AbstractContextManager, nullcontext
from copy import deepcopy
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, ClassVar, Protocol
@@ -235,7 +235,7 @@ class GraphRuntimeState:
self._response_coordinator = response_coordinator
# Application code injects this when worker threads must restore request
# or framework-local state. It is intentionally excluded from snapshots.
self._execution_context = execution_context
self._execution_context = execution_context if execution_context is not None else nullcontext()
self._pending_response_coordinator_dump: str | None = None
self._pending_graph_execution_workflow_id: str | None = None
self._paused_nodes: set[str] = set()
@@ -335,12 +335,12 @@ class GraphRuntimeState:
return self._response_coordinator
@property
def execution_context(self) -> AbstractContextManager[object] | None:
def execution_context(self) -> AbstractContextManager[object]:
return self._execution_context
@execution_context.setter
def execution_context(self, value: AbstractContextManager[object] | None) -> None:
self._execution_context = value
self._execution_context = value if value is not None else nullcontext()
# ------------------------------------------------------------------
# Scalar state