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

feat: make Signal and SignalInstance Generic, support static type validation of signal connections #304

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
prebuild sig
tlambert03 committed Apr 4, 2024

Verified

This commit was signed with the committer’s verified signature.
tlambert03 Talley Lambert
commit 66a86ceba2805cff08cfb33a3a68f514de98d034
3 changes: 2 additions & 1 deletion src/psygnal/_signal.py
Original file line number Diff line number Diff line change
@@ -534,7 +534,7 @@
reemission: ReemissionVal = DEFAULT_REEMISSION,
) -> None:
if isinstance(types, Signature):
types = tuple(

Check warning on line 537 in src/psygnal/_signal.py

Codecov / codecov/patch

src/psygnal/_signal.py#L537

Added line #L537 was not covered by tests
x.annotation
for x in types.parameters.values()
if x.kind is x.POSITIONAL_OR_KEYWORD
@@ -550,6 +550,7 @@
self._instance: Callable = self._instance_ref(instance)
self._args_queue: list[tuple] = [] # filled when paused
self._types = types
self._signature = _build_signature(*types)
self._check_nargs_on_connect = check_nargs_on_connect
self._check_types_on_connect = check_types_on_connect
self._slots: list[WeakCallback] = []
@@ -584,7 +585,7 @@
@property
def signature(self) -> Signature:
"""Signature supported by this `SignalInstance`."""
return _build_signature(*self._types)
return self._signature

@property
def instance(self) -> Any: