From 0b26c720b28fe31f8a79fc5a9dc907fbd0f67162 Mon Sep 17 00:00:00 2001 From: Why <694029828@qq.com> Date: Wed, 12 Jul 2023 00:41:38 +0800 Subject: [PATCH] Fix TypeError for AttrDcit in Python <= 3.8 (#75) --- shap_e/util/collections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shap_e/util/collections.py b/shap_e/util/collections.py index c3d823a..8b8d04b 100644 --- a/shap_e/util/collections.py +++ b/shap_e/util/collections.py @@ -1,8 +1,11 @@ from collections import OrderedDict from typing import Any, Callable, Dict, List, Optional +from typing import OrderedDict, Generic, TypeVar +K = TypeVar('K') +V = TypeVar('V') -class AttrDict(OrderedDict): +class AttrDict(OrderedDict[K, V], Generic[K, V]): """ An attribute dictionary that automatically handles nested keys joined by "/".