summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-09-09 18:16:37 +0100
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-09-09 18:16:37 +0100
commitf6b3884f365bbc02d7cde6ad377ce6f5d0cfae27 (patch)
treef7f8ef1b28aba3a963936dc8f9ea0479c75ef3f5 /synapse/events
parentMake EventFormatVersions an enum (diff)
downloadsynapse-f6b3884f365bbc02d7cde6ad377ce6f5d0cfae27.tar.xz
Remove the 's' from EventFormatVersions
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/__init__.py18
-rw-r--r--synapse/events/builder.py6
-rw-r--r--synapse/events/validator.py4
3 files changed, 14 insertions, 14 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index 2afaa8e77c..454e01445a 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -38,7 +38,7 @@ from typing_extensions import Literal
 from unpaddedbase64 import encode_base64
 
 from synapse.api.constants import RelationTypes
-from synapse.api.room_versions import EventFormatVersions, RoomVersion, RoomVersions
+from synapse.api.room_versions import EventFormatVersion, RoomVersion, RoomVersions
 from synapse.types import JsonDict, RoomStreamToken
 from synapse.util.caches import intern_dict
 from synapse.util.frozenutils import freeze
@@ -293,7 +293,7 @@ class _EventInternalMetadata:
 class EventBase(metaclass=abc.ABCMeta):
     @property
     @abc.abstractmethod
-    def format_version(self) -> EventFormatVersions:
+    def format_version(self) -> EventFormatVersion:
         """The EventFormatVersion implemented by this event"""
         ...
 
@@ -442,7 +442,7 @@ class EventBase(metaclass=abc.ABCMeta):
 
 
 class FrozenEvent(EventBase):
-    format_version = EventFormatVersions.ROOM_V1_V2  # All events of this type are V1
+    format_version = EventFormatVersion.ROOM_V1_V2  # All events of this type are V1
 
     def __init__(
         self,
@@ -490,7 +490,7 @@ class FrozenEvent(EventBase):
 
 
 class FrozenEventV2(EventBase):
-    format_version = EventFormatVersions.ROOM_V3  # All events of this type are V2
+    format_version = EventFormatVersion.ROOM_V3  # All events of this type are V2
 
     def __init__(
         self,
@@ -567,7 +567,7 @@ class FrozenEventV2(EventBase):
 class FrozenEventV3(FrozenEventV2):
     """FrozenEventV3, which differs from FrozenEventV2 only in the event_id format"""
 
-    format_version = EventFormatVersions.ROOM_V4_PLUS  # All events of this type are V3
+    format_version = EventFormatVersion.ROOM_V4_PLUS  # All events of this type are V3
 
     @property
     def event_id(self) -> str:
@@ -584,7 +584,7 @@ class FrozenEventV3(FrozenEventV2):
 
 
 def _event_type_from_format_version(
-    format_version: EventFormatVersions,
+    format_version: EventFormatVersion,
 ) -> Type[Union[FrozenEvent, FrozenEventV2, FrozenEventV3]]:
     """Returns the python type to use to construct an Event object for the
     given event format version.
@@ -597,11 +597,11 @@ def _event_type_from_format_version(
         `FrozenEvent`
     """
 
-    if format_version == EventFormatVersions.ROOM_V1_V2:
+    if format_version == EventFormatVersion.ROOM_V1_V2:
         return FrozenEvent
-    elif format_version == EventFormatVersions.ROOM_V3:
+    elif format_version == EventFormatVersion.ROOM_V3:
         return FrozenEventV2
-    elif format_version == EventFormatVersions.ROOM_V4_PLUS:
+    elif format_version == EventFormatVersion.ROOM_V4_PLUS:
         return FrozenEventV3
     else:
         raise Exception("No event format %r" % (format_version,))
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index 746bd3978d..2c36164ca2 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -20,7 +20,7 @@ from signedjson.types import SigningKey
 from synapse.api.constants import MAX_DEPTH
 from synapse.api.room_versions import (
     KNOWN_EVENT_FORMAT_VERSIONS,
-    EventFormatVersions,
+    EventFormatVersion,
     RoomVersion,
 )
 from synapse.crypto.event_signing import add_hashes_and_signatures
@@ -137,7 +137,7 @@ class EventBuilder:
         # The types of auth/prev events changes between event versions.
         prev_events: Union[List[str], List[Tuple[str, Dict[str, str]]]]
         auth_events: Union[List[str], List[Tuple[str, Dict[str, str]]]]
-        if format_version == EventFormatVersions.ROOM_V1_V2:
+        if format_version == EventFormatVersion.ROOM_V1_V2:
             auth_events = await self._store.add_event_hashes(auth_event_ids)
             prev_events = await self._store.add_event_hashes(prev_event_ids)
         else:
@@ -253,7 +253,7 @@ def create_local_event_from_event_dict(
 
     time_now = int(clock.time_msec())
 
-    if format_version == EventFormatVersions.ROOM_V1_V2:
+    if format_version == EventFormatVersion.ROOM_V1_V2:
         event_dict["event_id"] = _create_event_id(clock, hostname)
 
     event_dict["origin"] = hostname
diff --git a/synapse/events/validator.py b/synapse/events/validator.py
index a6f0104396..f5ebf2a3d7 100644
--- a/synapse/events/validator.py
+++ b/synapse/events/validator.py
@@ -18,7 +18,7 @@ import jsonschema
 
 from synapse.api.constants import MAX_ALIAS_LENGTH, EventTypes, Membership
 from synapse.api.errors import Codes, SynapseError
-from synapse.api.room_versions import EventFormatVersions
+from synapse.api.room_versions import EventFormatVersion
 from synapse.config.homeserver import HomeServerConfig
 from synapse.events import EventBase
 from synapse.events.builder import EventBuilder
@@ -45,7 +45,7 @@ class EventValidator:
         """
         self.validate_builder(event)
 
-        if event.format_version == EventFormatVersions.ROOM_V1_V2:
+        if event.format_version == EventFormatVersion.ROOM_V1_V2:
             EventID.from_string(event.event_id)
 
         required = [