Stop sub-classing object (#8249)

This commit is contained in:
Patrick Cloke 2020-09-04 06:54:56 -04:00 committed by GitHub
parent 9f8abdcc38
commit c619253db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
168 changed files with 293 additions and 292 deletions

View file

@ -86,7 +86,7 @@ def _make_scheduler(reactor):
return _scheduler
class IPBlacklistingResolver(object):
class IPBlacklistingResolver:
"""
A proxy for reactor.nameResolver which only produces non-blacklisted IP
addresses, preventing DNS rebinding attacks on URL preview.
@ -133,7 +133,7 @@ class IPBlacklistingResolver(object):
r.resolutionComplete()
@provider(IResolutionReceiver)
class EndpointReceiver(object):
class EndpointReceiver:
@staticmethod
def resolutionBegan(resolutionInProgress):
pass
@ -192,7 +192,7 @@ class BlacklistingAgentWrapper(Agent):
)
class SimpleHttpClient(object):
class SimpleHttpClient:
"""
A simple, no-frills HTTP client with methods that wrap up common ways of
using HTTP in Matrix
@ -244,7 +244,7 @@ class SimpleHttpClient(object):
)
@implementer(IReactorPluggableNameResolver)
class Reactor(object):
class Reactor:
def __getattr__(_self, attr):
if attr == "nameResolver":
return nameResolver

View file

@ -31,7 +31,7 @@ class ProxyConnectError(ConnectError):
@implementer(IStreamClientEndpoint)
class HTTPConnectProxyEndpoint(object):
class HTTPConnectProxyEndpoint:
"""An Endpoint implementation which will send a CONNECT request to an http proxy
Wraps an existing HostnameEndpoint for the proxy.

View file

@ -36,7 +36,7 @@ logger = logging.getLogger(__name__)
@implementer(IAgent)
class MatrixFederationAgent(object):
class MatrixFederationAgent:
"""An Agent-like thing which provides a `request` method which correctly
handles resolving matrix server names when using matrix://. Handles standard
https URIs as normal.
@ -175,7 +175,7 @@ class MatrixFederationAgent(object):
@implementer(IAgentEndpointFactory)
class MatrixHostnameEndpointFactory(object):
class MatrixHostnameEndpointFactory:
"""Factory for MatrixHostnameEndpoint for parsing to an Agent.
"""
@ -198,7 +198,7 @@ class MatrixHostnameEndpointFactory(object):
@implementer(IStreamClientEndpoint)
class MatrixHostnameEndpoint(object):
class MatrixHostnameEndpoint:
"""An endpoint that resolves matrix:// URLs using Matrix server name
resolution (i.e. via SRV). Does not check for well-known delegation.

View file

@ -33,7 +33,7 @@ SERVER_CACHE = {}
@attr.s(slots=True, frozen=True)
class Server(object):
class Server:
"""
Our record of an individual server which can be tried to reach a destination.
@ -96,7 +96,7 @@ def _sort_server_list(server_list):
return results
class SrvResolver(object):
class SrvResolver:
"""Interface to the dns client to do SRV lookups, with result caching.
The default resolver in twisted.names doesn't do any caching (it has a CacheResolver,

View file

@ -71,11 +71,11 @@ _had_valid_well_known_cache = TTLCache("had-valid-well-known")
@attr.s(slots=True, frozen=True)
class WellKnownLookupResult(object):
class WellKnownLookupResult:
delegated_server = attr.ib()
class WellKnownResolver(object):
class WellKnownResolver:
"""Handles well-known lookups for matrix servers.
"""

View file

@ -76,7 +76,7 @@ _next_id = 1
@attr.s(frozen=True)
class MatrixFederationRequest(object):
class MatrixFederationRequest:
method = attr.ib()
"""HTTP method
:type: str
@ -203,7 +203,7 @@ async def _handle_json_response(
return body
class MatrixFederationHttpClient(object):
class MatrixFederationHttpClient:
"""HTTP client used to talk to other homeservers over the federation
protocol. Send client certificates and signs requests.
@ -226,7 +226,7 @@ class MatrixFederationHttpClient(object):
)
@implementer(IReactorPluggableNameResolver)
class Reactor(object):
class Reactor:
def __getattr__(_self, attr):
if attr == "nameResolver":
return nameResolver

View file

@ -145,7 +145,7 @@ LaterGauge(
)
class RequestMetrics(object):
class RequestMetrics:
def start(self, time_sec, name, method):
self.start = time_sec
self.start_context = current_context()

View file

@ -174,7 +174,7 @@ def wrap_async_request_handler(h):
return preserve_fn(wrapped_async_request_handler)
class HttpServer(object):
class HttpServer:
""" Interface for registering callbacks on a HTTP server
"""

View file

@ -256,7 +256,7 @@ def assert_params_in_dict(body, required):
raise SynapseError(400, "Missing params: %r" % absent, Codes.MISSING_PARAM)
class RestServlet(object):
class RestServlet:
""" A Synapse REST Servlet.