psygnal.utils #
These utilities may help when using signals and evented objects.
Functions:
-
iter_signal_instances–Yield all
SignalInstanceattributes found onobj. -
monitor_events–Context manager to print or collect events emitted by SignalInstances on
obj.
decompile #
decompile() -> None
Mangle names of mypyc-compiled files so that they aren't used.
This function requires write permissions to the psygnal source directory.
Source code in src/psygnal/utils.py
127 128 129 130 131 132 133 134 | |
iter_signal_instances #
iter_signal_instances(
obj: Any, include_private_attrs: bool = False
) -> Generator[SignalInstance, None, None]
Yield all SignalInstance attributes found on obj.
Parameters:
-
(obj#object) –Any object that has an attribute that has a SignalInstance (or SignalGroup).
-
(include_private_attrs#bool, default:False) –Whether private signals (starting with an underscore) should also be logged, by default False
Yields:
-
SignalInstance–SignalInstances (and SignalGroups) found as attributes on
obj.
Source code in src/psygnal/utils.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
monitor_events #
monitor_events(
obj: Any | None = None,
logger: Callable[
[EmissionInfo], Any
] = _default_event_monitor,
include_private_attrs: bool = False,
) -> Iterator[None]
Context manager to print or collect events emitted by SignalInstances on obj.
Parameters:
-
(obj#object, default:None) –Any object that has an attribute that has a SignalInstance (or SignalGroup). If None, all SignalInstances will be monitored.
-
(logger#Callable[[EmissionInfo], None], default:_default_event_monitor) –A optional function to handle the logging of the event emission. This function must take two positional args: a signal name string, and a tuple that contains the emitted arguments. The default logger simply prints the signal name and emitted args.
-
(include_private_attrs#bool, default:False) –Whether private signals (starting with an underscore) should also be logged, by default False
Source code in src/psygnal/utils.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
recompile #
recompile() -> None
Fix all name-mangled mypyc-compiled files so that they ARE used.
This function requires write permissions to the psygnal source directory.
Source code in src/psygnal/utils.py
137 138 139 140 141 142 143 144 | |