| 1356 | |
| 1357 | |
| 1358 | class _lazy_collection(_LazyCollectionProtocol[_T]): |
| 1359 | def __init__(self, obj: Any, target: str): |
| 1360 | self.parent = obj |
| 1361 | self.target = target |
| 1362 | |
| 1363 | def __call__( |
| 1364 | self, |
| 1365 | ) -> Union[MutableSet[_T], MutableMapping[Any, _T], MutableSequence[_T]]: |
| 1366 | return getattr(self.parent, self.target) # type: ignore[no-any-return] |
| 1367 | |
| 1368 | def __getstate__(self) -> Any: |
| 1369 | return {"obj": self.parent, "target": self.target} |
| 1370 | |
| 1371 | def __setstate__(self, state: Any) -> None: |
| 1372 | self.parent = state["obj"] |
| 1373 | self.target = state["target"] |
| 1374 | |
| 1375 | |
| 1376 | _IT = TypeVar("_IT", bound="Any") |