mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:26:09 -04:00
Use auto_attribs/native type hints for attrs classes. (#11692)
This commit is contained in:
parent
b92a2ff797
commit
10a88ba91c
40 changed files with 300 additions and 307 deletions
|
@ -32,9 +32,9 @@ class ProxyConnectError(ConnectError):
|
|||
pass
|
||||
|
||||
|
||||
@attr.s
|
||||
@attr.s(auto_attribs=True)
|
||||
class ProxyCredentials:
|
||||
username_password = attr.ib(type=bytes)
|
||||
username_password: bytes
|
||||
|
||||
def as_proxy_authorization_value(self) -> bytes:
|
||||
"""
|
||||
|
|
|
@ -123,37 +123,37 @@ class ByteParser(ByteWriteable, Generic[T], abc.ABC):
|
|||
pass
|
||||
|
||||
|
||||
@attr.s(slots=True, frozen=True)
|
||||
@attr.s(slots=True, frozen=True, auto_attribs=True)
|
||||
class MatrixFederationRequest:
|
||||
method = attr.ib(type=str)
|
||||
method: str
|
||||
"""HTTP method
|
||||
"""
|
||||
|
||||
path = attr.ib(type=str)
|
||||
path: str
|
||||
"""HTTP path
|
||||
"""
|
||||
|
||||
destination = attr.ib(type=str)
|
||||
destination: str
|
||||
"""The remote server to send the HTTP request to.
|
||||
"""
|
||||
|
||||
json = attr.ib(default=None, type=Optional[JsonDict])
|
||||
json: Optional[JsonDict] = None
|
||||
"""JSON to send in the body.
|
||||
"""
|
||||
|
||||
json_callback = attr.ib(default=None, type=Optional[Callable[[], JsonDict]])
|
||||
json_callback: Optional[Callable[[], JsonDict]] = None
|
||||
"""A callback to generate the JSON.
|
||||
"""
|
||||
|
||||
query = attr.ib(default=None, type=Optional[dict])
|
||||
query: Optional[dict] = None
|
||||
"""Query arguments.
|
||||
"""
|
||||
|
||||
txn_id = attr.ib(default=None, type=Optional[str])
|
||||
txn_id: Optional[str] = None
|
||||
"""Unique ID for this request (for logging)
|
||||
"""
|
||||
|
||||
uri = attr.ib(init=False, type=bytes)
|
||||
uri: bytes = attr.ib(init=False)
|
||||
"""The URI of this request
|
||||
"""
|
||||
|
||||
|
|
|
@ -534,9 +534,9 @@ class XForwardedForRequest(SynapseRequest):
|
|||
|
||||
|
||||
@implementer(IAddress)
|
||||
@attr.s(frozen=True, slots=True)
|
||||
@attr.s(frozen=True, slots=True, auto_attribs=True)
|
||||
class _XForwardedForAddress:
|
||||
host = attr.ib(type=str)
|
||||
host: str
|
||||
|
||||
|
||||
class SynapseSite(Site):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue