mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 11:16:24 +00:00
clean up some type annotations
This commit is contained in:
parent
911b54267b
commit
ee8155729d
@ -9,7 +9,7 @@ from __future__ import annotations
|
||||
from typing import Any, Protocol, Sequence, Mapping, Optional, Union, Awaitable
|
||||
from typing_extensions import Literal
|
||||
|
||||
from attrs import frozen, define
|
||||
from attrs import frozen
|
||||
|
||||
from .interfaces import IAddressFamily
|
||||
from .util.iputil import allocate_tcp_port
|
||||
@ -101,7 +101,7 @@ class StaticProvider:
|
||||
"""
|
||||
_available: bool
|
||||
_hide_ip: bool
|
||||
_config: Union[Awaitable[ListenerConfig], ListenerConfig]
|
||||
_config: Union[Awaitable[Optional[ListenerConfig]], Optional[ListenerConfig]]
|
||||
_address: IAddressFamily
|
||||
|
||||
def is_available(self) -> bool:
|
||||
@ -110,8 +110,8 @@ class StaticProvider:
|
||||
def can_hide_ip(self) -> bool:
|
||||
return self._hide_ip
|
||||
|
||||
async def create_config(self, reactor: Any, cli_config: Any) -> ListenerConfig:
|
||||
if isinstance(self._config, ListenerConfig):
|
||||
async def create_config(self, reactor: Any, cli_config: Any) -> Optional[ListenerConfig]:
|
||||
if self._config is None or isinstance(self._config, ListenerConfig):
|
||||
return self._config
|
||||
return await self._config
|
||||
|
||||
|
@ -42,7 +42,7 @@ def can_hide_ip() -> Literal[True]:
|
||||
def is_available() -> bool:
|
||||
return not (_import_tor() is None or _import_txtorcon() is None)
|
||||
|
||||
def create(reactor, config, import_tor=None, import_txtorcon=None) -> Optional[_Provider]:
|
||||
def create(reactor, config, import_tor=None, import_txtorcon=None) -> _Provider:
|
||||
"""
|
||||
Create a new _Provider service (this is an IService so must be
|
||||
hooked up to a parent or otherwise started).
|
||||
|
Loading…
Reference in New Issue
Block a user