Skip to content

Commit

Permalink
inline argument validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vivaansinghvi07 committed Feb 15, 2025
1 parent 8838962 commit 5eec37c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions teeplot/teeplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,6 @@ def teed(*args, **kwargs):
saveit()


def validate_teewrap_kwargs(teeplot_kwargs: dict[str, object]):
if not all(k.startswith("teeplot_") for k in teeplot_kwargs):
raise ValueError(
"The `teewrap` decorator only accepts teeplot_* keyword arguments"
)


def teewrap(
**teeplot_kwargs: object,
):
Expand All @@ -398,7 +391,10 @@ def teewrap(
the same across function calls. For printing attributes on a per-call basis,
see `teeplot_outinclude` in `teeplot.tee`.
"""
validate_teewrap_kwargs(teeplot_kwargs)
if not all(k.startswith("teeplot_") for k in teeplot_kwargs):
raise ValueError(
"The `teewrap` decorator only accepts teeplot_* keyword arguments"
)

def decorator(f: typing.Callable):
@functools.wraps(f)
Expand Down

0 comments on commit 5eec37c

Please sign in to comment.