Files
2125_GCE/glyphos/__pycache__/events.cpython-314.pyc
T

94 lines
9.2 KiB
Plaintext
Raw Normal View History

+
2026-07-09 12:54:44 -04:00
þÜ0jZãóÞaRt0tRt^RIt^RIt^RIHtHtHtHtH t H
t
2026-07-09 12:54:44 -04:00
H t ]P!]
4t]
R,t!RR] RR7t!RR4tRs]^kR R
ltR R ltR
RltR#)zÓGlyphOS Event System
Lightweight, in-process event bus for symbolic events.
2026-07-09 12:54:44 -04:00
Captures cognition-related events from Cognitive Kernel / LAIN.
Exposes glyph activation and resonance changes as first-class events.
N)ÚCallableÚDictÚListÚOptionalÚ TypedDictÚLiteralÚAnycó0a]tRt^toRtV3RltRtVtR#)ÚEventz%Event structure with optional fields.cóT<V^8„dQh/S[;R&S[;R&S[S[S[3,;R&#)éÚtypeÚ timestampÚpayload)Ú EventTypeÚfloatrÚstrr)ÚformatÚ
__classdict__s"€Ú%/home/t420/2125_GCE/glyphos/events.pyÚ __annotate__ÚEvent.__annotate__s1ø‡á
2026-07-09 12:54:44 -04:00
ñÑññ‘#‘s(ò ó©N)Ú__name__Ú
__module__Ú __qualname__Ú__firstlineno__Ú__doc__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©rs@rr
r
sø‡Ùƒrr
F)Útotalcóªa]tRt^toRtV3RlRltV3RlRltV3RlRltV3RlR ltRV3R lR llt V3R
lRlt
RV3RlRllt Rt Vt
2026-07-09 12:54:44 -04:00
R
#)ÚEventBusz‡Lightweight in-process event bus.
2026-07-09 12:54:44 -04:00
Manages subscriptions and publishing of symbolic events.
Maintains event history for introspection.
có<V^8„dQhRR/#©r ÚreturnNr)rrs"€rrÚEventBus.__annotate__&sø€÷(˜(rc ó"/Vn.VnR#)zInitialize an empty EventBus.N)Ú _subscribersÚ_history©Úselfs&rÚ__init__ÚEventBus.__init__&sàLNˆÔØ%'ˆŽ
rcó@<V^8„dQhRS[RS[S[.R3,RR/#©r Ú
2026-07-09 12:54:44 -04:00
event_typeÚhandlerNr(©rrr
)rrs"€rrr)+s.ø€÷  :¡Ið Á%ÀÈ$ÀÕ8Oð :ÐTXñ :rc óºWP9d.VPV&W PV,9d%VPV,PV4R#R#)zœRegister a handler for a specific event type.
Args:
event_type: Type of event to listen for
2026-07-09 12:54:44 -04:00
handler: Callable that takes an Event and returns None
N)r+Úappend©r.r3r4s&&&rÚ subscribeÚEventBus.subscribe+sOð × .Ø,.ˆD× Ñ ˜jÑ ×+¨JÕ × Ñ ˜jÕ Ö  8rcó@<V^8„dQhRS[RS[S[.R3,RR/#r2r5)rrs"€rrr)8s3ø€÷ Wñ W¡ið W¹(ÁEÀ7ÈDÀ=Õ:Qð WÐVZñ Wrc óÆWP9d&VPV,PV4R#R# \d\P RT R24R#i;i)z{Remove a handler if present.
Args:
event_type: Type of event to stop listening for
handler: The handler to remove
zHandler not found for z during unsubscribeN)r+ÚremoveÚ
ValueErrorÚloggerÚdebugr8s&&&rÚ unsubscribeÚEventBus.unsubscribe8s^ð × 
WØ×! *Õ4°WÖ +øôô
WÜ Ð5°j°\ÐATÐ
Wús"8¸$A ÁA cóB<V^8„dQhRS[RS[S[S[3,RS[/#©r r3rr(©rrrrr
2026-07-09 12:54:44 -04:00
)rrs"€rrr)Es*ø€÷ñ¡)ð±d¹3Á¸8µnðÉñrc ó@RVR\P!4RV/pVPPV4WP9d$VPV,F pV!V4K V# \d'p\
P
RT RT 24Rp?K>Rp?ii;i)z»Create an Event, append to history, and invoke all handlers.
Args:
event_type: Type of event
payload: Event payload data
Returns:
The published Event (with timestamp added)
2026-07-09 12:54:44 -04:00
r
rrzEvent handler error for z: N)Útimer,r7r+Ú Exceptionr?Úwarning)r.r3rÚeventr4Úes&&& rÚpublishÚEventBus.publishEð
 œŸšØ 
ˆð
×јUÔ × ×,¨Z×8ðQÙ˜E–Nñ ˆ øôQÜ—N‘NÐ%=¸j¸\ÈÈAÈ3Ð#O×PûðQúsÁA,Á, BÁ7BÂBNcóL<V^8„dQhRS[S[,RS[RS[S[,/#)r r3Úlimitr()rrÚintrr
2026-07-09 12:54:44 -04:00
)rrs"€rrr)bs.ø€÷"¡9Õ9Ù=@ð
‰eñ9rc óÞVf%VP'dVPV)R#.#VPUu.uFq3PR4V8XgKVNK ppV'dWB)R#.#uupi)zÖReturn recent events, optionally filtered by type.
Args:
event_type: If provided, filter to only this event type
limit: Maximum number of events to return
Returns:
2026-07-09 12:54:44 -04:00
List of recent events (newest last)
Nr
)r,Úget)r.r3rOrKÚfiltereds&&& rÚ get_historyÚEventBus.get_historybsmð Ò à-1¯]¯]¨]4—=‘= %  Ð Ð $(§=¢=ÓP¡=˜a·E±E¸&³MÀZÑ4OŸ˜¡=ˆPß(08˜F˜ 8°bÐ 8ùòQs ·A*ÁA*có<V^8„dQhRR/#r'r)rrs"€rrr)vsø€÷ñ˜tñrc ó.VnR#)zClear all stored events.N)r,r-s&rÚ
clear_historyÚEventBus.clear_historyvs àˆŽ
rcó6<V^8„dQhRS[S[,RS[/#)r r3r()rrrP)rrs"€rrr)zs ø€÷  >©x¹ Õ/Bð >Écñ >rc ó¨Vf+\RVPP444#\VPP V.44#)zŠGet number of subscribers (for testing).
Args:
event_type: If provided, count for this type only
Returns:
2026-07-09 12:54:44 -04:00
Number of subscribers
c3ó8"TFp\V4xK R#5i©N)Úlen)Ú.0Úhandlerss& rÚ <genexpr>Ú0EventBus.get_subscriber_count.<locals>.<genexpr>„séÐPÑ5O¨”s˜8—}}Ó5Oùs)Úsumr+Úvaluesr^rR)r.r3s&&rÚget_subscriber_countÚEventBus.get_subscriber_countzsHð Ò ÜÑP°T×5FÑ5F×5MÑ5MÔ5OÓ t×(×,¨Z¸Ó =r)r,r+)Nédr])rrrrrr/r9rArLrTrXrer r!r"s@rr%r%sWø‡ñ÷ 
  Wð W÷ð÷:9÷(ð÷   >rr%có$V^8„dQhR\/#)r r()r%)rs"rrrs÷ñ”xñrcó2\f \4s\#)z¬Get or create the singleton EventBus instance.
On first call, creates a new EventBus.
Returns same instance on subsequent calls.
Returns:
Singleton EventBus instance
)Ú _GLOBAL_BUSr%rrrÚ
get_event_busrksôÒÜ“jˆ ä Ðrcó^V^8„dQhR\R\\\3,R\/#rDrE)rs"rrržs)÷

2026-07-09 12:54:44 -04:00
,”Yð
¬c´3¨h­ð
,¼Eñ