Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrapper function was over-writing the documentation #131

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading