Skip to content

Commit

Permalink
fix: wrapper function was over-writing the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonMarchand committed Nov 13, 2024
1 parent 9bba0ff commit 3af789c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions src/ipyaladin/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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

Expand Down

0 comments on commit 3af789c

Please sign in to comment.