From 024b5e428a84c3a78eda4b163bb47693224b6067 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 20 Jul 2023 14:23:31 -0400 Subject: [PATCH] narrow the type annotation for another Listener method param --- src/allmydata/listeners.py | 7 ++++--- src/allmydata/util/i2p_provider.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/allmydata/listeners.py b/src/allmydata/listeners.py index 6af19d1b9..f97f699b4 100644 --- a/src/allmydata/listeners.py +++ b/src/allmydata/listeners.py @@ -14,6 +14,7 @@ from twisted.python.usage import Options from .interfaces import IAddressFamily from .util.iputil import allocate_tcp_port +from .node import _Config @frozen class ListenerConfig: @@ -57,7 +58,7 @@ class Listener(Protocol): 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 previously-generated configuration. @@ -91,7 +92,7 @@ class TCPProvider: return ListenerConfig(tub_ports, tub_locations, {}) - def create(self, reactor: Any, config: Any) -> IAddressFamily: + def create(self, reactor: Any, config: _Config) -> IAddressFamily: raise NotImplementedError() @@ -116,5 +117,5 @@ class StaticProvider: return 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 diff --git a/src/allmydata/util/i2p_provider.py b/src/allmydata/util/i2p_provider.py index e9188c6ae..c480cd2f1 100644 --- a/src/allmydata/util/i2p_provider.py +++ b/src/allmydata/util/i2p_provider.py @@ -21,8 +21,9 @@ from ..listeners import ListenerConfig from ..interfaces import ( 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 hooked up to a parent or otherwise started).