pantalaimon: Mypy fixes.

This commit is contained in:
Damir Jelić 2019-06-11 11:24:37 +02:00
parent 5b58294a95
commit c7ca5d9851
6 changed files with 8 additions and 9 deletions

View File

@ -51,9 +51,9 @@ def parse_address(value):
return ip_address(value)
def parse_url(value):
def parse_url(v):
# type: (str) -> ParseResult
value = urlparse(value)
value = urlparse(v)
if value.scheme not in ('http', 'https'):
raise ValueError(f"Invalid URL scheme {value.scheme}. "

View File

@ -390,7 +390,7 @@ class ProxyDaemon:
self,
request, # type: aiohttp.web.BaseRequest
params=None, # type: CIMultiDict
data=None, # type: Dict[Any, Any]
data=None, # type: bytes
session=None, # type: aiohttp.ClientSession
token=None # type: str
):

View File

@ -36,7 +36,8 @@ class Searcher:
self.room_field = room_field
self.timestamp_field = timestamp_field
def search(self, search_term, room=None, max_results=10, order_by_date=False):
def search(self, search_term, room=None, max_results=10,
order_by_date=False):
# type (str, str, int, bool) -> List[int, int]
"""Search for events in the index.

View File

@ -123,7 +123,7 @@ async def message_router(receive_queue, send_queue, proxies):
"connect to pantalaimon.")
)
@click.version_option(version=0.1, prog_name="pantalaimon")
@click.version_option(version="0.1", prog_name="pantalaimon")
@click.option("--log-level", type=click.Choice([
"error",
"warning",

View File

@ -659,7 +659,7 @@ class PanCtl:
help=("panctl is a small interactive repl to introspect and control"
"the pantalaimon daemon.")
)
@click.version_option(version=0.1, prog_name="panctl")
@click.version_option(version="0.1", prog_name="panctl")
def main():
loop = asyncio.get_event_loop()
glib_loop = GLib.MainLoop()

View File

@ -184,8 +184,6 @@ class PanStore:
profile=profile_id
).on_conflict_ignore().execute()
# TODO why do we get a 0 on conflict here, the test show that we get the
# existing event id.
if event_id <= 0:
return None
@ -207,7 +205,7 @@ class PanStore:
column, # type: List[int]
include_profile=False # type: bool
):
# type: (...) -> Union[List[Dict[Any, Any]], List[Tuple[Dict, Dict]]]
# type: (...) -> Optional[Dict]
server = Servers.get(name=server)
user = ServerUsers.get(server=server, user_id=pan_user)