diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-12-30 13:47:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 18:47:12 +0000 |
commit | cbd82d0b2db069400b5d43373838817d8a0209e7 (patch) | |
tree | 5380e1b2c6ad6e112754f45d0d85274f7a8641e8 /synapse/http | |
parent | Add type hints to `synapse/storage/databases/main/events_bg_updates.py` (#11654) (diff) | |
download | synapse-cbd82d0b2db069400b5d43373838817d8a0209e7.tar.xz |
Convert all namedtuples to attrs. (#11665)
To improve type hints throughout the code.
Diffstat (limited to 'synapse/http')
-rw-r--r-- | synapse/http/server.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py index e302946591..09b4125489 100644 --- a/synapse/http/server.py +++ b/synapse/http/server.py @@ -14,7 +14,6 @@ # limitations under the License. import abc -import collections import html import logging import types @@ -37,6 +36,7 @@ from typing import ( Union, ) +import attr import jinja2 from canonicaljson import encode_canonical_json from typing_extensions import Protocol @@ -354,9 +354,11 @@ class DirectServeJsonResource(_AsyncResource): return_json_error(f, request) -_PathEntry = collections.namedtuple( - "_PathEntry", ["pattern", "callback", "servlet_classname"] -) +@attr.s(slots=True, frozen=True, auto_attribs=True) +class _PathEntry: + pattern: Pattern + callback: ServletCallback + servlet_classname: str class JsonResource(DirectServeJsonResource): |