From 7e7b99bca9da9bb5c8ba16aec51eef114c084561 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 5 May 2021 15:02:35 +0100 Subject: Slots --- synapse/events/__init__.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'synapse') diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 7a598a8193..baae3be69c 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -206,6 +206,28 @@ class _EventInternalMetadata: class EventBase(metaclass=abc.ABCMeta): + __slots__ = [ + "room_version", + "signatures", + "unsigned", + "rejected_reason", + "_dict", + "auth_events", + "depth", + "content", + "hashes", + "origin", + "origin_server_ts", + "prev_events", + "redacts", + "room_id", + "sender", + "type", + "user_id", + "state_key", + "internal_metadata", + ] + @property @abc.abstractmethod def format_version(self) -> int: @@ -364,6 +386,8 @@ class FrozenEvent(EventBase): class FrozenEventV2(EventBase): + __slots__ = ["_event_id"] + format_version = EventFormatVersions.V2 # All events of this type are V2 def __init__( @@ -452,6 +476,8 @@ class FrozenEventV2(EventBase): class FrozenEventV3(FrozenEventV2): """FrozenEventV3, which differs from FrozenEventV2 only in the event_id format""" + __slots__ = ["_event_id"] + format_version = EventFormatVersions.V3 # All events of this type are V3 @property -- cgit 1.5.1