PandaBus
This library provided a simple event bus.
Using Example
#1:Basic Using
from pandabus import bus
# Create to event listener(printb should called after printa)
@bus.listen("print")
def printa(ent):
print(f"hello from printa")
@bus.listen("print",after="printa")
def printb(ent):
print(f'hello from printb')
# send event
bus.send("print")
#2:Pro Using
from pandabus import bus, Event
class StaticEvent(Event, static=True):
msg: str
class DynaEvent(Event, cancelable=True):
msg:str
# Create to event listener(printb should called after printa,printc)
@bus.listen(StaticEvent)
def printa(ent):
print(f"{ent.msg} from printa")
@bus.listen(StaticEvent)
def printb(ent):
print(f"{ent.msg} from printb")
@bus.listen(StaticEvent, after=["printa","printb"])
def printc(ent):
print(f'{ent.msg} from printc')
@bus.listen(DynaEvent)
def printd(ent):
print(f"{ent.msg} from printd")
ent.cancel()
@bus.listen(DynaEvent,after="printd")
def printe(ent):
print(f"{ent.msg} from printe")
# send event
bus.send(StaticEvent,"hello")
bus.send(DynaEvent,"hello again")
#3:Own Bus?
from pandabus import buses, Bus
bus1 = buses.bus1 # Simplely get a own bus.
bus2 = Bus("bus2") # Work too.
Metadata
Release files for pandabus 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pandabus-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for pandabus-0.0.5-py3-none-any.whl |
Release files / pandabus-0.0.5-py3-none-any.whl
| Download URL | pandabus-0.0.5-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8a331736bf7d9596134866197f561c2864f17ae94ee3533f7032d5886fa4116
|
|
BLAKE2b-256 checksum How to use checksums |
7ddac3273f6342abb47e42d013f7cbca0e4c87b2ce775111b8cdd19af5ead8f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for pandabus 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.