diff --git a/CHANGELOG.md b/CHANGELOG.md index 1068f7c..c8c82a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix wrapper `widget_should_be_loaded` that was over-writing the methods documentation + [#130] + ## [0.5.1] ### Changed diff --git a/src/ipyaladin/widget.py b/src/ipyaladin/widget.py index c4d18f2..4ae10f5 100644 --- a/src/ipyaladin/widget.py +++ b/src/ipyaladin/widget.py @@ -6,9 +6,10 @@ """ from collections.abc import Callable +import functools +from json import JSONDecodeError import io import pathlib -from json import JSONDecodeError from pathlib import Path import time from typing import ClassVar, Dict, Final, List, Optional, Tuple, Union @@ -74,12 +75,12 @@ ] -def widget_should_be_loaded(func: Callable) -> Callable: +def widget_should_be_loaded(function: Callable) -> Callable: """Check if the widget is ready to execute a function. Parameters ---------- - func : Callable + function : Callable The function to decorate. Returns @@ -89,6 +90,7 @@ def widget_should_be_loaded(func: Callable) -> Callable: """ + @functools.wraps(function) def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any: """Check if the widget is ready to execute a function. @@ -114,7 +116,7 @@ def wrapper(self: Any, *args: Any, **kwargs: Any) -> Any: time.sleep(duration) # set ready to True to avoid waiting twice self._is_loaded = True - return func(self, *args, **kwargs) + return function(self, *args, **kwargs) return wrapper