mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 04:04:59 -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
|
@ -12,14 +12,16 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
from collections import namedtuple
|
||||
from typing import TYPE_CHECKING, Any, Awaitable, Callable, List, Tuple
|
||||
|
||||
import attr
|
||||
|
||||
from synapse.replication.tcp.streams._base import (
|
||||
Stream,
|
||||
current_token_without_instance,
|
||||
make_http_update_function,
|
||||
)
|
||||
from synapse.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from synapse.server import HomeServer
|
||||
|
@ -30,13 +32,10 @@ class FederationStream(Stream):
|
|||
sending disabled.
|
||||
"""
|
||||
|
||||
FederationStreamRow = namedtuple(
|
||||
"FederationStreamRow",
|
||||
(
|
||||
"type", # str, the type of data as defined in the BaseFederationRows
|
||||
"data", # dict, serialization of a federation.send_queue.BaseFederationRow
|
||||
),
|
||||
)
|
||||
@attr.s(slots=True, frozen=True, auto_attribs=True)
|
||||
class FederationStreamRow:
|
||||
type: str # the type of data as defined in the BaseFederationRows
|
||||
data: JsonDict # serialization of a federation.send_queue.BaseFederationRow
|
||||
|
||||
NAME = "federation"
|
||||
ROW_TYPE = FederationStreamRow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue