Skip to content

Commit

Permalink
Add a kind item to allow differentiating dora and external events
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Aug 22, 2023
1 parent bd875f6 commit bc7bfd5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apis/python/operator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ pub struct PyEvent {
#[pymethods]
impl PyEvent {
pub fn __getitem__(&self, key: &str, py: Python<'_>) -> PyResult<Option<PyObject>> {
if key == "kind" {
let kind = match &self.event {
MergedEvent::Dora(_) => "dora",
MergedEvent::External(_) => "external",
};
return Ok(Some(kind.to_object(py)));
}
match &self.event {
MergedEvent::Dora(event) => {
let value = match key {
Expand Down

0 comments on commit bc7bfd5

Please sign in to comment.