narrow the type annotation for another Listener method param

This commit is contained in:
Jean-Paul Calderone 2023-07-20 14:23:31 -04:00
parent 57facc6335
commit 024b5e428a
2 changed files with 6 additions and 4 deletions

View File

@ -14,6 +14,7 @@ from twisted.python.usage import Options
from .interfaces import IAddressFamily from .interfaces import IAddressFamily
from .util.iputil import allocate_tcp_port from .util.iputil import allocate_tcp_port
from .node import _Config
@frozen @frozen
class ListenerConfig: class ListenerConfig:
@ -57,7 +58,7 @@ class Listener(Protocol):
overall *tahoe.cfg* configuration file. overall *tahoe.cfg* configuration file.
""" """
def create(self, reactor: Any, config: Any) -> IAddressFamily: def create(self, reactor: Any, config: _Config) -> IAddressFamily:
""" """
Instantiate this listener according to the given Instantiate this listener according to the given
previously-generated configuration. previously-generated configuration.
@ -91,7 +92,7 @@ class TCPProvider:
return ListenerConfig(tub_ports, tub_locations, {}) return ListenerConfig(tub_ports, tub_locations, {})
def create(self, reactor: Any, config: Any) -> IAddressFamily: def create(self, reactor: Any, config: _Config) -> IAddressFamily:
raise NotImplementedError() raise NotImplementedError()
@ -116,5 +117,5 @@ class StaticProvider:
return self._config return self._config
return await self._config return await self._config
def create(self, reactor: Any, config: Any) -> IAddressFamily: def create(self, reactor: Any, config: _Config) -> IAddressFamily:
return self._address return self._address

View File

@ -21,8 +21,9 @@ from ..listeners import ListenerConfig
from ..interfaces import ( from ..interfaces import (
IAddressFamily, IAddressFamily,
) )
from ..node import _Config
def create(reactor: Any, config: Any) -> IAddressFamily: def create(reactor: Any, config: _Config) -> IAddressFamily:
""" """
Create a new Provider service (this is an IService so must be Create a new Provider service (this is an IService so must be
hooked up to a parent or otherwise started). hooked up to a parent or otherwise started).