summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-05-05 13:42:58 +0100
committerErik Johnston <erik@matrix.org>2021-05-05 13:52:29 +0100
commitc856e29ccd63aa10d1c03434b1bc021753305348 (patch)
tree506412b623253d86b37b3a7fcb35c2abd5c4e04e /synapse/events
parentTime external cache response time (#9904) (diff)
downloadsynapse-c856e29ccd63aa10d1c03434b1bc021753305348.tar.xz
Remvoe dictionary based access form events
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/__init__.py28
1 files changed, 5 insertions, 23 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index c8b52cbc7a..46d26e0af9 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -263,12 +263,6 @@ class EventBase(metaclass=abc.ABCMeta):
 
         return d
 
-    def get(self, key, default=None):
-        return self._dict.get(key, default)
-
-    def get_internal_metadata_dict(self):
-        return self.internal_metadata.get_dict()
-
     def get_pdu_json(self, time_now=None) -> JsonDict:
         pdu_json = self.get_dict()
 
@@ -285,18 +279,6 @@ class EventBase(metaclass=abc.ABCMeta):
     def __set__(self, instance, value):
         raise AttributeError("Unrecognized attribute %s" % (instance,))
 
-    def __getitem__(self, field):
-        return self._dict[field]
-
-    def __contains__(self, field):
-        return field in self._dict
-
-    def items(self):
-        return list(self._dict.items())
-
-    def keys(self):
-        return self._dict.keys()
-
     def prev_event_ids(self):
         """Returns the list of prev event IDs. The order matches the order
         specified in the event, though there is no meaning to it.
@@ -374,9 +356,9 @@ class FrozenEvent(EventBase):
 
     def __repr__(self):
         return "<FrozenEvent event_id=%r, type=%r, state_key=%r>" % (
-            self.get("event_id", None),
-            self.get("type", None),
-            self.get("state_key", None),
+            self.event_id,
+            self.type,
+            getattr(self, "state_key", None),
         )
 
 
@@ -461,8 +443,8 @@ class FrozenEventV2(EventBase):
         return "<%s event_id=%r, type=%r, state_key=%r>" % (
             self.__class__.__name__,
             self.event_id,
-            self.get("type", None),
-            self.get("state_key", None),
+            self.type,
+            self.state_key if self.is_state() else None,
         )