From 262cb9608521c8e3f691cf81c2d0aad321904ecf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 16 Dec 2023 19:41:53 +0000 Subject: [PATCH] Deployed 46e1083 with MkDocs version: 1.5.3 --- .nojekyll | 0 404.html | 1065 +++ api/emitters/asyncio-event-emitter/index.html | 1859 +++++ .../executor-event-emitter/index.html | 2310 ++++++ api/emitters/index.html | 2130 ++++++ api/emitters/rq-event-emitter/index.html | 1883 +++++ api/event-handler/index.html | 2611 +++++++ api/event-linker/index.html | 6072 +++++++++++++++ api/event/index.html | 1477 ++++ api/index.html | 1164 +++ assets/_mkdocstrings.css | 64 + assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.d7c377c4.min.js | 29 + assets/javascripts/bundle.d7c377c4.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.f886a092.min.js | 42 + .../workers/search.f886a092.min.js.map | 7 + assets/stylesheets/main.50c56a3b.min.css | 1 + assets/stylesheets/main.50c56a3b.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + contributing/index.html | 1728 +++++ getting-started/index.html | 1305 ++++ images/examples/debug-mode-example.png | Bin 0 -> 84189 bytes images/favicon/pyventus-logo.ico | Bin 0 -> 16724 bytes images/logo/pyventus-logo-black.svg | 1 + images/logo/pyventus-logo-name-slogan.svg | 1 + images/logo/pyventus-logo-name.svg | 1 + images/logo/pyventus-logo-white.svg | 1 + images/logo/pyventus-logo.svg | 1 + index.html | 2084 +++++ objects.inv | Bin 0 -> 1113 bytes release-notes/index.html | 1150 +++ search/search_index.json | 1 + sitemap.xml | 98 + sitemap.xml.gz | Bin 0 -> 341 bytes .../emitters/asyncio-event-emitter/index.html | 1469 ++++ .../executor-event-emitter/index.html | 1587 ++++ tutorials/emitters/index.html | 1638 ++++ .../emitters/rq-event-emitter/index.html | 1515 ++++ tutorials/event-linker/index.html | 2433 ++++++ tutorials/event/index.html | 1944 +++++ tutorials/index.html | 1156 +++ 76 files changed, 46038 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 api/emitters/asyncio-event-emitter/index.html create mode 100644 api/emitters/executor-event-emitter/index.html create mode 100644 api/emitters/index.html create mode 100644 api/emitters/rq-event-emitter/index.html create mode 100644 api/event-handler/index.html create mode 100644 api/event-linker/index.html create mode 100644 api/event/index.html create mode 100644 api/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.d7c377c4.min.js create mode 100644 assets/javascripts/bundle.d7c377c4.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.f886a092.min.js create mode 100644 assets/javascripts/workers/search.f886a092.min.js.map create mode 100644 assets/stylesheets/main.50c56a3b.min.css create mode 100644 assets/stylesheets/main.50c56a3b.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 contributing/index.html create mode 100644 getting-started/index.html create mode 100644 images/examples/debug-mode-example.png create mode 100644 images/favicon/pyventus-logo.ico create mode 100644 images/logo/pyventus-logo-black.svg create mode 100644 images/logo/pyventus-logo-name-slogan.svg create mode 100644 images/logo/pyventus-logo-name.svg create mode 100644 images/logo/pyventus-logo-white.svg create mode 100644 images/logo/pyventus-logo.svg create mode 100644 index.html create mode 100644 objects.inv create mode 100644 release-notes/index.html create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 tutorials/emitters/asyncio-event-emitter/index.html create mode 100644 tutorials/emitters/executor-event-emitter/index.html create mode 100644 tutorials/emitters/index.html create mode 100644 tutorials/emitters/rq-event-emitter/index.html create mode 100644 tutorials/event-linker/index.html create mode 100644 tutorials/event/index.html create mode 100644 tutorials/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..adee891 --- /dev/null +++ b/404.html @@ -0,0 +1,1065 @@ + + + +
+ + + + + + + + + + + + + + + + + + +AsyncIOEventEmitter
class
+ Bases: EventEmitter
A class that inherits from EventEmitter
and uses the AsyncIO
framework to handle
+the execution of the event handlers.
Asynchronous Execution: In an asynchronous context where an event loop is already +running, the event handlers are scheduled and processed concurrently on that existing +loop. If the event loop is closed before all callbacks complete, any remaining +scheduled tasks will be canceled.
+Synchronous Execution: In a synchronous context where no event loop is active, a new event
+loop is started and subsequently closed by the asyncio.run()
method. Within this loop, it
+concurrently executes the event handlers using the asyncio.gather()
method. The loop then
+waits for all scheduled callbacks to finish before closing. This preserves synchronous
+execution while still gaining the benefits of the concurrent execution.
For more information and code examples, please refer to the AsyncIOEventEmitter
+tutorials at: https://github.com/mdapena/pyventus.
pyventus/emitters/asyncio/asyncio_event_emitter.py
10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +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 +85 +86 +87 +88 +89 |
|
Emits an event and triggers any associated event handlers. When emitting Event
or
+Exception
objects, they are automatically passed to the event handler as the
+first positional argument, even if you pass *args
or **kwargs
.
Note: If there are event handlers subscribed to the emission of any Event
or
+Exception
, they will also be executed.
PARAMETER | +DESCRIPTION | +
---|---|
event |
+
+
+
+ The event to emit. It can be an instance of
+
+ TYPE:
+ |
+
args |
+
+
+
+ Additional positional arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ Additional keyword arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/emitters/event_emitter.py
66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 |
|
Initializes an instance of the AsyncIOEventEmitter
class.
PARAMETER | +DESCRIPTION | +
---|---|
event_linker |
+
+
+
+ Specifies the type of event linker to use for associating events with their respective event handlers. Defaults to
+
+ TYPE:
+ |
+
debug_mode |
+
+
+
+ Specifies the debug mode for the subclass logger. If
+
+ TYPE:
+ |
+
pyventus/emitters/asyncio/asyncio_event_emitter.py
ExecutorEventEmitter
class
+ Bases: EventEmitter
An event emitter that executes event handlers concurrently using an Executor
.
This class utilizes the concurrent.futures
Executor base class to handle asynchronous
+execution of event handlers. It can work with either ThreadPoolExecutor
for thread-based
+execution or ProcessPoolExecutor
for process-based execution.
By inheriting from EventEmitter
and utilizing the Executor
interface, this class
+provides a consistent way to emit events and execute handlers asynchronously in either
+threads or processes. This allows choosing the optimal execution approach based on
+application needs.
Note: It is important to properly manage the underlying Executor
when using
+this event emitter. Once finished emitting events, call the shutdown()
method to
+signal the executor to free any resources for pending futures.
with
statement,
+ which will shut down the Executor
(waiting as if Executor.shutdown()
were called
+ with wait
set to True
).For more information and code examples, please refer to the ExecutorEventEmitter
+tutorials at: https://github.com/mdapena/pyventus.
pyventus/emitters/executor/executor_event_emitter.py
12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 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 + 85 + 86 + 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 |
|
Emits an event and triggers any associated event handlers. When emitting Event
or
+Exception
objects, they are automatically passed to the event handler as the
+first positional argument, even if you pass *args
or **kwargs
.
Note: If there are event handlers subscribed to the emission of any Event
or
+Exception
, they will also be executed.
PARAMETER | +DESCRIPTION | +
---|---|
event |
+
+
+
+ The event to emit. It can be an instance of
+
+ TYPE:
+ |
+
args |
+
+
+
+ Additional positional arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ Additional keyword arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/emitters/event_emitter.py
66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 |
|
__init__(executor: Executor = ThreadPoolExecutor(), event_linker: Type[EventLinker] = EventLinker, debug_mode: bool | None = None)
+
Initializes an instance of the ExecutorEventEmitter
class.
PARAMETER | +DESCRIPTION | +
---|---|
executor |
+
+
+
+ The executor object used for executing event handlers. Defaults to
+
+ TYPE:
+ |
+
event_linker |
+
+
+
+ Specifies the type of event linker to use for associating events with their respective event handlers. Defaults to
+
+ TYPE:
+ |
+
debug_mode |
+
+
+
+ Specifies the debug mode for the subclass logger. If
+
+ TYPE:
+ |
+
pyventus/emitters/executor/executor_event_emitter.py
Returns the instance of ExecutorEventEmitter
for context management.
RETURNS | +DESCRIPTION | +
---|---|
+
+ ExecutorEventEmitter
+
+ |
+
+
+
+ The instance of |
+
__exit__(exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) -> None
+
Cleans up the executor resources when exiting the context.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
exc_type |
+
+
+
+ The exception type, if any. +
+
+ TYPE:
+ |
+
exc_val |
+
+
+
+ The exception value, if any. +
+
+ TYPE:
+ |
+
exc_tb |
+
+
+
+ The traceback information, if any. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ A boolean indicating whether to propagate any exception or not. + |
+
pyventus/emitters/executor/executor_event_emitter.py
Shuts down the executor and frees any resources it is using.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
wait |
+
+
+
+ A boolean indicating whether to wait for the currently pending futures to complete before shutting down. +
+
+ TYPE:
+ |
+
cancel_futures |
+
+
+
+ A boolean indicating whether to cancel any pending futures. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/emitters/executor/executor_event_emitter.py
EventEmitter
class
+ Bases: ABC
An abstract base class for event emitters.
+This abstract base class defines a common interface for emitting events. It serves as
+a foundation for implementing custom event emitters with specific dispatch strategies.
+It is designed to handle string-named
events with variable-length argument list and
+arbitrary keyword arguments, as well as instances of Event
objects and Exceptions
.
The main goal of this class is to decouple the dispatching of event handler callbacks +from the underlying implementation. This loose coupling promotes flexibility and +adaptability through separation of concerns, allowing custom event emitters to +be implemented without affecting existing consumers.
+For more information and code examples, please refer to the EventEmitter
tutorials
+at: https://github.com/mdapena/pyventus.
pyventus/emitters/event_emitter.py
16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 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 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 |
|
Initializes an instance of the EventEmitter
.
PARAMETER | +DESCRIPTION | +
---|---|
event_linker |
+
+
+
+ Specifies the type of event linker to use for associating events with their respective event handlers. Defaults to
+
+ TYPE:
+ |
+
debug_mode |
+
+
+
+ Specifies the debug mode for the subclass logger. If
+
+ TYPE:
+ |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the |
+
pyventus/emitters/event_emitter.py
Emits an event and triggers any associated event handlers. When emitting Event
or
+Exception
objects, they are automatically passed to the event handler as the
+first positional argument, even if you pass *args
or **kwargs
.
Note: If there are event handlers subscribed to the emission of any Event
or
+Exception
, they will also be executed.
PARAMETER | +DESCRIPTION | +
---|---|
event |
+
+
+
+ The event to emit. It can be an instance of
+
+ TYPE:
+ |
+
args |
+
+
+
+ Additional positional arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ Additional keyword arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/emitters/event_emitter.py
66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 |
|
abstractmethod
+
+
+Executes the callbacks associated with the specified event handlers.
+This method is responsible for executing the callbacks associated with each event
+handler provided in the event_handlers
parameter. The callbacks will be executed
+with the positional arguments provided in *args
and the keyword arguments provided
+in **kwargs
.
Note: Subclasses must implement this method to define how the event handler +callbacks should be executed based on their specific context and requirements.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
event_handlers |
+
+
+
+ List of event handlers to be executed. +
+
+ TYPE:
+ |
+
args |
+
+
+
+ Positional arguments to pass to the callbacks. +
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ Keyword arguments to pass to the callbacks. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/emitters/event_emitter.py
RQEventEmitter
class
+ Bases: EventEmitter
A class that enables event handling using the powerful Redis Queue (RQ) pub/sub and +worker system.
+This class extends the base EventEmitter
class and provides the functionality to enqueue
+event handlers using the RQ package. Once enqueued, these event
+handlers are processed by RQ workers. This event emitter is particularly useful when
+dealing with events that require resource-intensive tasks like model optimization
+or video processing.
For more information and code examples, please refer to the RQEventEmitter
tutorials
+at: https://github.com/mdapena/pyventus.
pyventus/emitters/rq/rq_event_emitter.py
Emits an event and triggers any associated event handlers. When emitting Event
or
+Exception
objects, they are automatically passed to the event handler as the
+first positional argument, even if you pass *args
or **kwargs
.
Note: If there are event handlers subscribed to the emission of any Event
or
+Exception
, they will also be executed.
PARAMETER | +DESCRIPTION | +
---|---|
event |
+
+
+
+ The event to emit. It can be an instance of
+
+ TYPE:
+ |
+
args |
+
+
+
+ Additional positional arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ Additional keyword arguments to pass to the event handlers. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/emitters/event_emitter.py
66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 |
|
__init__(queue: Queue, options: Dict[str, Any] | None = None, event_linker: Type[EventLinker] = EventLinker, debug_mode: bool | None = None)
+
Initializes an instance of the RQEventEmitter
class.
PARAMETER | +DESCRIPTION | +
---|---|
queue |
+
+
+
+ The Redis queue for enqueuing event handlers. +
+
+ TYPE:
+ |
+
options |
+
+
+
+ Additional options for the RQ package enqueueing method. Defaults to an empty dictionary. +
+
+ TYPE:
+ |
+
event_linker |
+
+
+
+ Specifies the type of event linker to use for associating events with their respective event handlers. Defaults to
+
+ TYPE:
+ |
+
debug_mode |
+
+
+
+ Specifies the debug mode for the subclass logger. If
+
+ TYPE:
+ |
+
pyventus/emitters/rq/rq_event_emitter.py
EventHandler
classA class that encapsulates event callbacks.
+The EventHandler
class provides a mechanism for managing and executing callbacks
+when an event occurs.
Important: The __call__
method of the EventHandler
class is always an async
+method and returns a Coroutine
. It should never be treated as a sync function.
Note: The event handler can be invoked by calling the instance as a function
+and passing the necessary arguments. If the event handler has the once
property
+set to True
, it will only be invoked once when the event occurs. If once
is set
+to False
(default), the event handler will be invoked every time the event occurs
+until explicitly unsubscribed. Also, this class is not intended to be subclassed or
+created manually. It is used internally to encapsulate the callbacks associated
+with an event.
pyventus/handlers/event_handler.py
22 + 23 + 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 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 |
|
property
+
+
+Determines if the handler is a one-time handler.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+ | +
+
+
+
|
+
property
+
+
+Gets the timestamp of when the event handler was registered.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+ | +
+
+
+ The timestamp of when this handler was registered. + |
+
staticmethod
+
+
+get_callback_name(callback: EventCallbackType | SuccessCallbackType | FailureCallbackType | None) -> str
+
pyventus/handlers/event_handler.py
staticmethod
+
+
+validate_callback(callback: EventCallbackType | SuccessCallbackType | FailureCallbackType) -> None
+
Validates that the provided callback is a compatible callable.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
callback |
+
+
+
+ The callback to validate. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the callback is not a callable object. + |
+
pyventus/handlers/event_handler.py
staticmethod
+
+
+Checks if a callback is an asynchronous function or method.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
callback |
+
+
+
+ The callback to check. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ bool
+
+ |
+
+
+
+
|
+
pyventus/handlers/event_handler.py
__init__(event_callback: EventCallbackType, success_callback: SuccessCallbackType | None = None, failure_callback: FailureCallbackType | None = None, once: bool = False) -> None
+
Initializes an instance of the EventHandler
class.
PARAMETER | +DESCRIPTION | +
---|---|
event_callback |
+
+
+
+ The callback to be executed when the event occurs. +
+
+ TYPE:
+ |
+
success_callback |
+
+
+
+ The callback to be executed when the event execution completes successfully. +
+
+ TYPE:
+ |
+
failure_callback |
+
+
+
+ The callback to be executed when the event execution fails. +
+
+ TYPE:
+ |
+
once |
+
+
+
+ Specifies if the event handler is a one-time handler. If set to
+
+ TYPE:
+ |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If callbacks are invalid. + |
+
pyventus/handlers/event_handler.py
async
+
+
+Executes the event handler by invoking the associated callbacks.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
args |
+
+
+
+ Variable-length argument list. +
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ Arbitrary keyword arguments. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ Coroutine + |
+
pyventus/handlers/event_handler.py
EventLinker
class
+ Bases: ABC
A base class that acts as a global registry for linking events with their associated event +handlers.
+The EventLinker
class provides a centralized mechanism for managing event subscriptions,
+unsubscriptions, and retrieval of events and their associated event handlers. It acts as a
+global registry, ensuring that events and their handlers are organized and easily accessible.
The EventLinker
class can be subclassed to create specific namespaces or contexts for
+managing events and event handlers separately. By subclassing the EventLinker
, users can
+organize event subscriptions and handlers within different scopes, providing modularity and
+flexibility in event management. Subclassing also allows users to configure settings of the
+EventLinker
to suit their specific use cases.
Thread-Safe: The EventLinker
has been implemented with thread safety in mind. All of its
+methods synchronize access to prevent race conditions when managing events and event handlers
+across multiple threads. This ensures that concurrent operations on the EventLinker
are
+properly synchronized, avoiding data inconsistencies and race conditions.
For more information and code examples, please refer to the EventLinker
tutorials at:
+https://github.com/mdapena/pyventus.
pyventus/linkers/event_linker.py
18 + 19 + 20 + 21 + 22 + 23 + 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 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 |
|
A class that serves as a wrapper for event linking operations, providing a simplified +interface for subscribing events and associating callbacks.
+This class can be used as either a decorator or context manager. As a decorator, it +automatically subscribes the decorated callback to the specified events.
+When used as a context manager via the with
statement, it allows multiple callbacks
+to be associated with events within the context block.
Also, this class is not intended to be subclassed or created manually. It is used +internally to serves as a wrapper for event linking operation.
+ +pyventus/linkers/event_linker.py
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 + 85 + 86 + 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 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 |
|
property
+
+
+Decorator that sets the main callback for the event. This callback will be invoked +when the associated event occurs.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+ | +
+
+
+ The decorated callback. + |
+
property
+
+
+Decorator that sets the success callback. This callback will be invoked when the +event execution completes successfully.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+ | +
+
+
+ The decorated callback. + |
+
property
+
+
+Decorator that sets the failure callback. This callback will be invoked when the +event execution fails.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+ | +
+
+
+ The decorated callback. + |
+
Initializes the wrapper instance.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
events |
+
+
+
+ The events to link/subscribe to. +
+
+ TYPE:
+ |
+
event_linker |
+
+
+
+ The event linker type for associating events with callbacks. +
+
+ TYPE:
+ |
+
once |
+
+
+
+ Whether the callback is a one-time subscription. +
+
+ TYPE:
+ |
+
pyventus/linkers/event_linker.py
Decorates a callback to subscribe it to the specified events.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
callback |
+
+
+
+ The callback to associate. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ EventCallbackType
+
+ |
+
+
+
+ The decorated callback. + |
+
pyventus/linkers/event_linker.py
Enters the linkage context block, allowing multiple callbacks to be associated +with events within the block.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ EventLinkageWrapper
+
+ |
+
+
+
+ The context manager object + |
+
pyventus/linkers/event_linker.py
__exit__(exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) -> None
+
Exits the linkage context manager, subscribing any callbacks associated within the +block to the specified events. Also performs any cleanup.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
exc_type |
+
+
+
+ The type of the exception raised, if any. +
+
+ TYPE:
+ |
+
exc_val |
+
+
+
+ The exception object raised, if any. +
+
+ TYPE:
+ |
+
exc_tb |
+
+
+
+ The traceback information, if any. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ None + |
+
pyventus/linkers/event_linker.py
__init_subclass__(max_event_handlers: int | None = None, default_success_callback: SuccessCallbackType | None = None, default_failure_callback: FailureCallbackType | None = None, debug_mode: bool | None = None, **kwargs: Any) -> None
+
Custom __init_subclass__
method called when a subclass is created.
This method initializes the subclass by setting up the event registry and thread +lock. It also allows specifying the maximum number of event handlers per event.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
max_event_handlers |
+
+
+
+ The maximum number of event handlers allowed per event, or
+
+ TYPE:
+ |
+
default_success_callback |
+
+
+
+ The default callback to be assigned as the success callback in the event handlers when no specific success callback is provided. +
+
+ TYPE:
+ |
+
default_failure_callback |
+
+
+
+ The default callback to be assigned as the failure callback in the event handlers when no specific failure callback is provided. +
+
+ TYPE:
+ |
+
debug_mode |
+
+
+
+ Specifies the debug mode for the subclass logger. If
+
+ TYPE:
+ |
+
kwargs |
+
+
+
+ The keyword arguments to pass to the superclass
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ None
+
+ |
+
+
+
+ Any + |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If |
+
pyventus/linkers/event_linker.py
197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 |
|
classmethod
+
+
+Retrieves the event registry mapping.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ Mapping[str, List[EventHandler]]
+
+ |
+
+
+
+ A mapping of event names to event handlers. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Returns a list of all the registered event names.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ List[str]
+
+ |
+
+
+
+ A list of event names. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Retrieves a list of non-duplicated event handlers +who have been registered across all events.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ List[EventHandler]
+
+ |
+
+
+
+ A list of event handlers. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Retrieves the maximum number of handlers allowed per event.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ None | int
+
+ |
+
+
+
+ The maximum number of handlers or None if there is no limit. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Retrieves the default callback to be assigned as the success callback in + the event handlers when no specific success callback is provided.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ SuccessCallbackType | None
+
+ |
+
+
+
+ The default callback to be assigned as the success callback in the event handlers when no specific success callback is provided. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Retrieves the default callback to be assigned as the failure callback + in the event handlers when no specific failure callback is provided.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ FailureCallbackType | None
+
+ |
+
+
+
+ The default callback to be assigned as the failure callback in the event handlers when no specific failure callback is provided. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Retrieves a list of event names associated with the specified event handler.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
event_handler |
+
+
+
+ The handler to retrieve the associated events for. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ List[str]
+
+ |
+
+
+
+ A list of event names. + |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Retrieves a list of non-duplicated event handlers associated with the specified events.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
events |
+
+
+
+ Events to retrieve the handlers for. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ List[EventHandler]
+
+ |
+
+
+
+ A list of event handlers. + |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Decorator that subscribes a callback to the specified events to be invoked only once. +This decorator is used to conveniently subscribe a callback as a one-time handler.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
events |
+
+
+
+ The events to subscribe to. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ EventLinkageWrapper
+
+ |
+
+
+
+ The decorator that wraps the callback. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Decorator that subscribes a callback to the specified events.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
events |
+
+
+
+ The events to subscribe to. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ EventLinkageWrapper
+
+ |
+
+
+
+ The decorator that wraps the callback. + |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+subscribe(*events: SubscribableEventType, event_callback: EventCallbackType, success_callback: SuccessCallbackType | None = None, failure_callback: FailureCallbackType | None = None, once: bool = False) -> EventHandler
+
Subscribes callbacks to the specified events.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
events |
+
+
+
+ The events to subscribe to. +
+
+ TYPE:
+ |
+
event_callback |
+
+
+
+ The callback to be executed when the event occurs. +
+
+ TYPE:
+ |
+
success_callback |
+
+
+
+ The callback to be executed when the event execution completes successfully. +
+
+ TYPE:
+ |
+
failure_callback |
+
+
+
+ The callback to be executed when the event execution fails. +
+
+ TYPE:
+ |
+
once |
+
+
+
+ Specifies if the callback is a one-time subscription. If set to
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ EventHandler
+
+ |
+
+
+
+ The event handler object associated with the events. + |
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the maximum number of handlers for an event has been exceeded or if the |
+
pyventus/linkers/event_linker.py
406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 |
|
classmethod
+
+
+Unsubscribes an event handler from the specified events. The method removes the event +handler from the event registry and, if there are no more handlers for a particular +event, removes that event from the registry as well.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
events |
+
+
+
+ The events to unsubscribe from. +
+
+ TYPE:
+ |
+
event_handler |
+
+
+
+ The event handler to unsubscribe. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ bool
+
+ |
+
+
+
+
|
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Removes an event handler from all subscribed events. If there are no more +handlers for a particular event, that event is removed from the registry.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
event_handler |
+
+
+
+ The event handler to remove. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ bool
+
+ |
+
+
+
+
|
+
RAISES | +DESCRIPTION | +
---|---|
+
+ PyventusException
+
+ |
+
+
+
+ If the |
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Removes an event and all associated event handlers.
+ + + +PARAMETER | +DESCRIPTION | +
---|---|
event |
+
+
+
+ The event to remove. +
+
+ TYPE:
+ |
+
RETURNS | +DESCRIPTION | +
---|---|
+
+ bool
+
+ |
+
+
+
+
|
+
pyventus/linkers/event_linker.py
classmethod
+
+
+Removes all events and event handlers.
+ + + +RETURNS | +DESCRIPTION | +
---|---|
+
+ bool
+
+ |
+
+
+
+
|
+
pyventus/linkers/event_linker.py
Event
dataclassA base class for event objects.
+This class serves as a blueprint for creating event objects. It +is intended to be subclassed and extended by concrete event classes.
+Note: The Event
class is marked with frozen=True
, to ensure that its
+attributes cannot be modified once the event object is created. This is crucial
+because Pyventus supports both asynchronous and synchronous event handling concurrently.
+When payloads are accessible from multiple threads, having mutable payloads could lead
+to data inconsistencies. By freezing event objects, their integrity is preserved as
+they propagate through the system.
For more information and code examples, please refer to the Event
tutorials at:
+https://github.com/mdapena/pyventus.
pyventus/events/event.py
class-attribute
+ instance-attribute
+
+
+The date and time when the event occurred.
++ Welcome to the Pyventus API Reference, a comprehensive guide that provides detailed information about + the classes, functions, parameters, attributes, and other components available in Pyventus. +
+ ++ In the API Reference, you will find detailed documentation for each component, including clear explanations, + parameter details, return values, and usage examples. You can navigate through the reference using the search + functionality or by browsing the different sections and categories to find the specific information you need. +
+ +
+
+ Let's explore the Pyventus API Reference! +
+{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Wa=/["'&<>]/;Vn.exports=Ua;function Ua(e){var t=""+e,r=Wa.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i