Fix pyright type narrowing issue for dataclass check

Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-15 21:35:41 +00:00
Unverified
parent ea2022d634
commit c7605a0546
@@ -185,10 +185,10 @@ def decode_checkpoint_value(value: Any) -> Any:
if module is None:
module = importlib.import_module(module_name)
cls_dc: Any = getattr(module, class_name)
# Verify the class is actually a dataclass
if not is_dataclass(cls_dc):
# Verify the class is actually a dataclass type (not an instance)
if not isinstance(cls_dc, type) or not is_dataclass(cls_dc):
logger.debug(
f"Class {type_key_dc} is not a dataclass; returning raw value"
f"Class {type_key_dc} is not a dataclass type; returning raw value"
)
return decoded_raw
constructed = _instantiate_checkpoint_dataclass(cls_dc, decoded_raw)