From 493e6d68822e93023c7f3a29b96ae4675661ca33 Mon Sep 17 00:00:00 2001 From: Kyle Dunn Date: Tue, 17 Dec 2019 01:45:48 -0700 Subject: [PATCH] Preserve docstrings for element shortcut methods --- PySpice/Spice/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PySpice/Spice/__init__.py b/PySpice/Spice/__init__.py index 1dfd19f47..c893ce147 100644 --- a/PySpice/Spice/__init__.py +++ b/PySpice/Spice/__init__.py @@ -52,8 +52,10 @@ def _get_elements(module): for element_class in spice_elements + high_level_elements: def _make_function(element_class): - def function(self, *args, **kwargs): - return element_class(self, *args, **kwargs) + function = lambda self, *args, **kwargs: element_class(self, *args, **kwargs) + + # Preserve docstrings for element shortcuts + function.__doc__ = element_class.__doc__ return function func = _make_function(element_class)