Skip to content

Commit e1a2bc2

Browse files
committed
Fix EventTypes sometimes having None instead of UNKNOWN as the class
1 parent 0234224 commit e1a2bc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mautrix/types/event/type.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def find(cls, t: str, t_class: Optional[Class] = None) -> 'EventType':
4242
try:
4343
return cls.by_event_type[t].with_class(t_class)
4444
except KeyError:
45-
return EventType(t, t_class=t_class)
45+
return EventType(t, t_class=t_class or cls.Class.UNKNOWN)
4646

4747
def json(self) -> str:
4848
return json.dumps(self.serialize())
@@ -61,7 +61,7 @@ def __str__(self):
6161
return self.t
6262

6363
def __repr__(self):
64-
return f"EventType(\"{self.t}\", EventType.Class.{self.t_class.name})"
64+
return f'EventType("{self.t}", EventType.Class.{self.t_class.name})'
6565

6666
def __hash__(self):
6767
return hash(self.t) ^ hash(self.t_class)

0 commit comments

Comments
 (0)