From 948b63328e13a540ced8089033e10f97f01c1b55 Mon Sep 17 00:00:00 2001 From: Michael Bowling Date: Wed, 5 Jul 2023 08:33:50 -0400 Subject: [PATCH] Apply functools.wraps to Module methods to preserve docstrings --- equinox/_module.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/equinox/_module.py b/equinox/_module.py index 7b0b5cf1..f1b15d0b 100644 --- a/equinox/_module.py +++ b/equinox/_module.py @@ -101,7 +101,9 @@ def __init__(self, method): def __get__(self, instance, owner): if instance is None: return self.method - return jtu.Partial(self.method, instance) + _method = ft.wraps(self.method)(jtu.Partial(self.method, instance)) + delattr(_method, "__wrapped__") + return _method def _not_magic(k: str) -> bool: