From 82c99368538fe6e77bfbc7583da5a60080ed8f9d Mon Sep 17 00:00:00 2001 From: Gao Enhao Date: Sat, 11 Nov 2023 20:32:34 +0800 Subject: [PATCH] [MNT] add type check to __setattr__ --- abl/structures/list_data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/abl/structures/list_data.py b/abl/structures/list_data.py index 97660b4..6f055a1 100644 --- a/abl/structures/list_data.py +++ b/abl/structures/list_data.py @@ -121,7 +121,7 @@ class ListData(BaseDataElement): ) at 0x7f203542feb0> """ - def __setattr__(self, name: str, value: Sized): + def __setattr__(self, name: str, value: list): """setattr is only used to set data. The value must have the attribute of `__len__` and have the same length @@ -137,7 +137,7 @@ class ListData(BaseDataElement): ) else: - assert isinstance(value, Sized), "value must contain `__len__` attribute" + assert isinstance(value, list), "value must be of type `list`" if len(self) > 0: assert len(value) == len(self), (