endpoints.pyi 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. from typing import AnyStr, Optional
  2. from twisted.internet import interfaces
  3. from twisted.internet.defer import Deferred
  4. from twisted.internet.interfaces import (
  5. IOpenSSLClientConnectionCreator,
  6. IProtocol,
  7. IProtocolFactory,
  8. IStreamClientEndpoint,
  9. )
  10. from zope.interface import implementer
  11. @implementer(interfaces.IStreamClientEndpoint)
  12. class HostnameEndpoint:
  13. # Reactor should be a "provider of L{IReactorTCP}, L{IReactorTime} and
  14. # either L{IReactorPluggableNameResolver} or L{IReactorPluggableResolver}."
  15. # I don't know how to encode that in the type system.
  16. def __init__(
  17. self,
  18. reactor: object,
  19. host: AnyStr,
  20. port: int,
  21. timeout: float = ...,
  22. bindAddress: Optional[bytes] = ...,
  23. attemptDelay: Optional[float] = ...,
  24. ): ...
  25. def connect(self, protocol_factory: IProtocolFactory) -> Deferred[IProtocol]: ...
  26. def wrapClientTLS(
  27. connectionCreator: IOpenSSLClientConnectionCreator,
  28. wrappedEndpoint: IStreamClientEndpoint,
  29. ) -> IStreamClientEndpoint: ...