Skip to content
Snippets Groups Projects
Unverified Commit 5d8d752b authored by Marcus Schiesser's avatar Marcus Schiesser Committed by GitHub
Browse files

fix: filter none events in Python (#66)

parent a0b04be2
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ class CallbackEvent(BaseModel): ...@@ -11,7 +11,7 @@ class CallbackEvent(BaseModel):
payload: Optional[Dict[str, Any]] = None payload: Optional[Dict[str, Any]] = None
event_id: str = "" event_id: str = ""
def get_title(self): def get_title(self) -> str | None:
# Return as None for the unhandled event types # Return as None for the unhandled event types
# to avoid showing them in the UI # to avoid showing them in the UI
match self.event_type: match self.event_type:
...@@ -53,9 +53,9 @@ class EventCallbackHandler(BaseCallbackHandler): ...@@ -53,9 +53,9 @@ class EventCallbackHandler(BaseCallbackHandler):
event_id: str = "", event_id: str = "",
**kwargs: Any, **kwargs: Any,
) -> str: ) -> str:
self._aqueue.put_nowait( event = CallbackEvent(event_id=event_id, event_type=event_type, payload=payload)
CallbackEvent(event_id=event_id, event_type=event_type, payload=payload) if event.get_title() is not None:
) self._aqueue.put_nowait(event)
def on_event_end( def on_event_end(
self, self,
...@@ -64,9 +64,9 @@ class EventCallbackHandler(BaseCallbackHandler): ...@@ -64,9 +64,9 @@ class EventCallbackHandler(BaseCallbackHandler):
event_id: str = "", event_id: str = "",
**kwargs: Any, **kwargs: Any,
) -> None: ) -> None:
self._aqueue.put_nowait( event = CallbackEvent(event_id=event_id, event_type=event_type, payload=payload)
CallbackEvent(event_id=event_id, event_type=event_type, payload=payload) if event.get_title() is not None:
) self._aqueue.put_nowait(event)
def start_trace(self, trace_id: Optional[str] = None) -> None: def start_trace(self, trace_id: Optional[str] = None) -> None:
"""No-op.""" """No-op."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment