diff options
author | Patrick Cloke <patrickc@matrix.org> | 2023-04-14 12:15:38 -0400 |
---|---|---|
committer | Patrick Cloke <patrickc@matrix.org> | 2023-05-17 14:26:01 -0400 |
commit | b3e0354c980e4092e022884e8ec0a7a150440569 (patch) | |
tree | 014ec85ffa2f496d7b9bf8137132019dfc600771 | |
parent | Clean-up more references to relations store. (diff) | |
download | synapse-b3e0354c980e4092e022884e8ec0a7a150440569.tar.xz |
Be explicit about datastores.
-rw-r--r-- | synapse/storage/databases/main/__init__.py | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/synapse/storage/databases/main/__init__.py b/synapse/storage/databases/main/__init__.py index 867fd84179..2814368027 100644 --- a/synapse/storage/databases/main/__init__.py +++ b/synapse/storage/databases/main/__init__.py @@ -130,13 +130,6 @@ class DataStore( LockStore, SessionStore, ): - DATASTORE_CLASSES: List[Type[SQLBaseStore]] = [ - RelationsStore, - ] - - # XXX So mypy knows about dynamic properties. - relations: RelationsStore - def __init__( self, database: DatabasePool, @@ -149,18 +142,8 @@ class DataStore( super().__init__(database, db_conn, hs) - def repl(match: Match[str]) -> str: - return "_" + match.group(0).lower() - - for datastore_class in self.DATASTORE_CLASSES: - name = datastore_class.__name__ - if name.endswith("Store"): - name = name[: -len("Store")] - - name = re.sub(r"[A-Z]", repl, name)[1:] - - store = datastore_class(database, db_conn, hs, self) - setattr(self, name, store) + # This is a bit repetitive, but avoids dynamically setting attributes. + self.relations: RelationsStore = RelationsStore(database, db_conn, hs, self) async def get_users(self) -> List[JsonDict]: """Function to retrieve a list of users in users table. |