shap-e
shap-e copied to clipboard
Fix TypeError for AttrDcit in Python <= 3.8
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.