Fix flake8/mypy/isort code errors from new setup

This commit is contained in:
miruka
2020-11-15 14:57:00 -04:00
parent b170997cdb
commit 1e002eb4a5
13 changed files with 88 additions and 79 deletions

View File

@@ -11,7 +11,6 @@ from typing import Any, Dict, List, Optional, Tuple, Type, Union
from uuid import UUID
import lxml # nosec
import nio
from ..presence import Presence

View File

@@ -3,7 +3,7 @@
from collections import UserDict
from dataclasses import dataclass, field
from typing import Dict
from typing import Dict, List, Union
from . import SyncId
from .model import Model
@@ -47,7 +47,7 @@ class ModelStore(UserDict):
elif is_tuple and len(key) == 3 and key[2] == "autocompleted_members":
model = AutoCompletedMembers(user_id=key[0], room_id=key[1])
else:
model = Model(sync_id=key) # type: ignore
model = Model(sync_id=key)
self.data[key] = model
return model
@@ -62,7 +62,9 @@ class ModelStore(UserDict):
)
async def ensure_exists_from_qml(self, sync_id: SyncId) -> None:
async def ensure_exists_from_qml(
self, sync_id: Union[SyncId, List[str]],
) -> None:
"""Create model if it doesn't exist. Should only be called by QML."""
if isinstance(sync_id, list): # QML can't pass tuples

View File

@@ -40,7 +40,7 @@ class AllRooms(FieldSubstringFilter):
return source.sync_id == "accounts" or (
isinstance(source.sync_id, tuple) and
len(source.sync_id) == 2 and
source.sync_id[1] == "rooms" # type: ignore
source.sync_id[1] == "rooms"
)