-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Let's typecheck matrix federation agent * Improve type stub for twisted.python.log.err * Additional stubs that apply to matrixfederationagent * Annotate the _RoutingResult struct * Remove unused typeignore (now in mypy config) * Annotate well_known_cache * Annotate _parse_cache_control * Annotate _cache_period_from_headers * Annotate LoggingHostnameEndpoint * Annotate _do_get_well_known * Workaround no annotation for Headers.copy * annotate EndpointFactory * Avoid str/bytes confusion in well_known handling * Annotations for MatrixFederationAgent * Suppress reactor complaint for now * sydent.http/*.py now passes mypy --strict * Isort * Changelog * Additional linting --- looks like it didn't fully run? * Keep 3.6 flake8 happy with annotations on previous line * Review fixup
- Loading branch information
David Robertson
authored
Oct 28, 2021
1 parent
03f23b2
commit e4b4dbb
Showing
8 changed files
with
157 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Get `sydent.http.matrixfederationagent` to pass `mypy --strict`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typing import Any, AnyStr, Optional | ||
|
||
from twisted.internet import interfaces | ||
from twisted.internet.defer import Deferred | ||
from twisted.internet.interfaces import ( | ||
IOpenSSLClientConnectionCreator, | ||
IProtocol, | ||
IProtocolFactory, | ||
IStreamClientEndpoint, | ||
) | ||
from zope.interface import implementer | ||
|
||
@implementer(interfaces.IStreamClientEndpoint) | ||
class HostnameEndpoint: | ||
# Reactor should be a "provider of L{IReactorTCP}, L{IReactorTime} and | ||
# either L{IReactorPluggableNameResolver} or L{IReactorPluggableResolver}." | ||
# I don't know how to encode that in the type system. | ||
def __init__( | ||
self, | ||
reactor: object, | ||
host: AnyStr, | ||
port: int, | ||
timeout: float = 30, | ||
bindAddress: Optional[bytes] = None, | ||
attemptDelay: Optional[float] = None, | ||
): ... | ||
def connect(self, protocol_factory: IProtocolFactory) -> Deferred[IProtocol]: ... | ||
|
||
def wrapClientTLS( | ||
connectionCreator: IOpenSSLClientConnectionCreator, | ||
wrappedEndpoint: IStreamClientEndpoint, | ||
) -> IStreamClientEndpoint: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.