shap-e icon indicating copy to clipboard operation
shap-e copied to clipboard

Fix TypeError for AttrDcit in Python <= 3.8

Open onpix opened this issue 1 year ago • 0 comments

Description of Changes

This PR enhances the AttrDict class in the codebase to support generic types for type hinting. This change is necessary to ensure compatibility with Python 3.8. I noticed that the AttrDict class was being used in a way that suggested it should support subscripting for type hinting (e.g., AttrDict[str, Any]). However, using AttrDict in this way led to a TypeError in Python 3.8:

TypeError: 'type' object is not subscriptable

Code Changes

By adding Generic[K, V] to the AttrDict class, we now ensure compatibility with Python 3.8.

onpix avatar May 15 '23 15:05 onpix