Skip to content

Commit

Permalink
fix: use inspect.signature
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Aug 16, 2023
1 parent e2ef575 commit 2972264
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/superqt/utils/_throttler.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"""
from __future__ import annotations

import inspect
from concurrent.futures import Future
from enum import IntFlag, auto
from functools import wraps
Expand Down Expand Up @@ -212,8 +213,8 @@ def __init__(
# so we do it ourselfs and limit the number of positional arguments
# that we pass to func
try:
self._max_args: int | None = func.__code__.co_argcount
except AttributeError:
self._max_args: int | None = len(inspect.signature(func).parameters)
except Exception:
self._max_args = None

Check warning on line 218 in src/superqt/utils/_throttler.py

View check run for this annotation

Codecov / codecov/patch

src/superqt/utils/_throttler.py#L217-L218

Added lines #L217 - L218 were not covered by tests

def __call__(self, *args: P.args, **kwargs: P.kwargs) -> "Future[R]": # noqa
Expand Down

0 comments on commit 2972264

Please sign in to comment.