mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-07 16:35:05 -04:00
Convert all namedtuples to attrs. (#11665)
To improve type hints throughout the code.
This commit is contained in:
parent
07a3b5daba
commit
cbd82d0b2d
22 changed files with 231 additions and 206 deletions
|
@ -14,9 +14,10 @@
|
|||
|
||||
import logging
|
||||
import re
|
||||
from collections import namedtuple
|
||||
from typing import TYPE_CHECKING, Collection, Iterable, List, Optional, Set
|
||||
|
||||
import attr
|
||||
|
||||
from synapse.api.errors import SynapseError
|
||||
from synapse.events import EventBase
|
||||
from synapse.storage._base import SQLBaseStore, db_to_json, make_in_list_sql_clause
|
||||
|
@ -33,10 +34,15 @@ if TYPE_CHECKING:
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
SearchEntry = namedtuple(
|
||||
"SearchEntry",
|
||||
["key", "value", "event_id", "room_id", "stream_ordering", "origin_server_ts"],
|
||||
)
|
||||
|
||||
@attr.s(slots=True, frozen=True, auto_attribs=True)
|
||||
class SearchEntry:
|
||||
key: str
|
||||
value: str
|
||||
event_id: str
|
||||
room_id: str
|
||||
stream_ordering: Optional[int]
|
||||
origin_server_ts: int
|
||||
|
||||
|
||||
def _clean_value_for_search(value: str) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue