edit some parts where pycharm gives warning on type hint

This commit is contained in:
Huy Pham 2020-01-14 14:30:08 -08:00
parent 8a4ad41a47
commit 948a33f201
3 changed files with 7 additions and 12 deletions

View file

@ -176,7 +176,7 @@ class ViewConfigDialog(Dialog):
master: Any, master: Any,
app: "Application", app: "Application",
node_id: int, node_id: int,
data: bytes, data: str,
filename: str = None, filename: str = None,
): ):
super().__init__(master, app, f"n{node_id} config data", modal=True) super().__init__(master, app, f"n{node_id} config data", modal=True)

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Set from typing import TYPE_CHECKING, Optional, Set
from core.api.grpc.core_pb2 import NodeType from core.api.grpc.core_pb2 import NodeType
from core.gui.images import ImageEnum, Images from core.gui.images import ImageEnum, Images
@ -14,10 +14,10 @@ class NodeDraw:
def __init__(self): def __init__(self):
self.custom: bool = False self.custom: bool = False
self.image = None self.image = None
self.image_enum: ImageEnum = None self.image_enum: Optional[ImageEnum] = None
self.image_file = None self.image_file = None
self.node_type: core_pb2.NodeType = None self.node_type: core_pb2.NodeType = None
self.model: str = None self.model: Optional[str] = None
self.services: Set[str] = set() self.services: Set[str] = set()
@classmethod @classmethod
@ -39,7 +39,7 @@ class NodeDraw:
return node_draw return node_draw
@classmethod @classmethod
def from_custom(cls, name: str, image_file: str, services: str): def from_custom(cls, name: str, image_file: str, services: Set[str]):
node_draw = NodeDraw() node_draw = NodeDraw()
node_draw.custom = True node_draw.custom = True
node_draw.image_file = image_file node_draw.image_file = image_file

View file

@ -1,15 +1,10 @@
import logging import logging
import threading import threading
from typing import TYPE_CHECKING, Callable from typing import Any, Callable
if TYPE_CHECKING:
from core.gui.app import Application
class BackgroundTask: class BackgroundTask:
def __init__( def __init__(self, master: Any, task: Callable, callback: Callable = None, args=()):
self, master: "Application", task: Callable, callback: Callable = None, args=()
):
self.master = master self.master = master
self.args = args self.args = args
self.task = task self.task = task