@@ -64,7 +64,7 @@ def wrapper(cls: type[Event]) -> type[Event]:
64
64
# set the Event subclass `type` attribute, if it is set to anything
65
65
if isinstance (event_name_or_class , str ):
66
66
cls .type = event_name_or_class
67
- return cast (type [Event ], dataclass (kw_only = True )(cls ))
67
+ return cast (type [Event ], dataclass (kw_only = True , eq = False )(cls ))
68
68
69
69
# for using without parenthesis, wrap the passed class
70
70
if isinstance (event_name_or_class , type ) and issubclass (event_name_or_class , Event ):
@@ -75,7 +75,7 @@ def wrapper(cls: type[Event]) -> type[Event]:
75
75
76
76
77
77
# unfortunately we cannot directly use `eventclass` here, as it is making a typecheck to Event
78
- @dataclass (kw_only = True )
78
+ @dataclass (kw_only = True , eq = False )
79
79
class Event :
80
80
"""
81
81
Base class for custom analytics Events.
@@ -123,6 +123,18 @@ def from_instance(cls, instance: Any, **kwargs: Any) -> Self:
123
123
}
124
124
)
125
125
126
+ def __eq__ (self , other : Any ) -> bool :
127
+ if not isinstance (other , Event ):
128
+ return False
129
+
130
+ self_values = self .serialize ()
131
+ other_values = other .serialize ()
132
+
133
+ self_values .pop ("uuid" )
134
+ other_values .pop ("uuid" )
135
+
136
+ return self_values == other_values
137
+
126
138
127
139
def serialize_event (event : Event ) -> dict [str , Any ]:
128
140
# TODO: this is the "old-style" attributes based serializer. Once all events are migrated to the new style,
0 commit comments