Utilities#
These utilities may help when using signals and evented objects.
decompile()
#
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 psygnal/utils.py
127 128 129 130 131 132 133 134 |
|
iter_signal_instances(obj, include_private_attrs=False)
#
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
) –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 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(obj=None, logger=_default_event_monitor, include_private_attrs=False)
#
Context manager to print or collect events emitted by SignalInstances on obj
.
Parameters:
- obj (
object, optional
) –Any object that has an attribute that has a SignalInstance (or SignalGroup). If None, all SignalInstances will be monitored.
- logger (
Callable[[EmissionInfo], None], optional
) –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
) –Whether private signals (starting with an underscore) should also be logged, by default False
Source code in 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()
#
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 psygnal/utils.py
137 138 139 140 141 142 143 144 |
|