Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymilne committed Oct 25, 2023
1 parent 7b87e48 commit edefe6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vizro-core/src/vizro/models/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def __init__(self, function, /, *args, **kwargs):
"""Creates a new CapturedCallable object that will be able to re-run `function`.
Partially binds *args and **kwargs to the function call.
Raises:
ValueError if `function` contains positional-only or variadic positional parameters (*args).
"""
# It is difficult to get positional-only and variadic positional arguments working at the same time as
# variadic keyword arguments. Ideally we would do the __call__ as
Expand Down Expand Up @@ -201,6 +204,8 @@ def __call__(self, func, /):
# The more difficult case, where we need to still have a valid plotly figure that renders in a notebook.
# Hence we attach the CapturedCallable as a property instead of returning it directly.
# TODO: move point of checking that data_frame argument exists earlier on.
# TODO: also would be nice to raise errors in CapturedCallable.__init__ at point of function definition
# rather than point of calling if possible.
@functools.wraps(func)
def wrapped(*args, **kwargs) -> _DashboardReadyFigure:
if "data_frame" not in inspect.signature(func).parameters:
Expand Down

0 comments on commit edefe6a

Please sign in to comment.