mirror of
https://github.com/wassname/jaxtyping.git
synced 2026-09-09 11:24:55 +08:00
Fix abstractmethods being ignored after @jaxtyped
This commit is contained in:
@@ -31,7 +31,12 @@ class _Jaxtyped:
|
||||
self.fn = fn
|
||||
|
||||
def __get__(self, instance, owner):
|
||||
return ft.wraps(self.fn)(_Jaxtyped(self.fn.__get__(instance, owner)))
|
||||
if instance is None:
|
||||
# Don't create a new _Jaxtyped object in this case. Otherwise anything
|
||||
# assigned to methods (e.g. `__isabstractmethod__`) just gets swallowed.
|
||||
return self
|
||||
else:
|
||||
return ft.wraps(self.fn)(_Jaxtyped(self.fn.__get__(instance, owner)))
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user