mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Fix pyright type narrowing issue for dataclass check
Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user