diff options
author | Erik Johnston <erikj@jki.re> | 2019-01-25 10:23:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 10:23:51 +0000 |
commit | be6a7e47fa75d72466a356c254376b8eb0707bb2 (patch) | |
tree | 08902e6b1564b865a5b21194c844d85a693ef095 /synapse/events/__init__.py | |
parent | Merge pull request #4451 from matrix-org/erikj/require_format_version (diff) | |
download | synapse-be6a7e47fa75d72466a356c254376b8eb0707bb2.tar.xz |
Revert "Require event format version to parse or create events"
Diffstat (limited to 'synapse/events/__init__.py')
-rw-r--r-- | synapse/events/__init__.py | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index c3e6caf597..888296933b 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -18,11 +18,7 @@ from distutils.util import strtobool import six -from synapse.api.constants import ( - KNOWN_EVENT_FORMAT_VERSIONS, - KNOWN_ROOM_VERSIONS, - EventFormatVersions, -) +from synapse.api.constants import EventFormatVersions from synapse.util.caches import intern_dict from synapse.util.frozenutils import freeze @@ -244,36 +240,3 @@ class FrozenEvent(EventBase): self.get("type", None), self.get("state_key", None), ) - - -def room_version_to_event_format(room_version): - """Converts a room version string to the event format - - Args: - room_version (str) - - Returns: - int - """ - if room_version not in KNOWN_ROOM_VERSIONS: - raise - - return EventFormatVersions.V1 - - -def event_type_from_format_version(format_version): - """Returns the python type to use to construct an Event object for the - given event format version. - - Args: - format_version (int): The event format version - - Returns: - type: A type that can be initialized as per the initializer of - `FrozenEvent` - """ - if format_version not in KNOWN_EVENT_FORMAT_VERSIONS: - raise Exception( - "No event format %r" % (format_version,) - ) - return FrozenEvent |