1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 23:37:14 +03:00

#2032 Suppress some Type Hint Errors

This commit is contained in:
David Sangrey 2023-07-22 22:00:35 -04:00
parent 779318d86b
commit 8763e9f5db
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
2 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import time
import tkinter as tk
from calendar import timegm
from os.path import getsize, isdir, isfile
from typing import Any, Dict
from typing import Any, Dict, Optional
from config import config
from EDMCLogging import get_main_logger
@ -37,7 +37,7 @@ class Dashboard(FileSystemEventHandler):
self.session_start: int = int(time.time())
self.root: tk.Tk = None # type: ignore
self.currentdir: str = None # type: ignore # The actual logdir that we're monitoring
self.observer: Observer = None # type: ignore
self.observer: Optional[Observer] = None # type: ignore
self.observed = None # a watchdog ObservedWatch, or None if polling
self.status: Dict[str, Any] = {} # Current status for communicating status back to main thread

View File

@ -43,6 +43,7 @@ if sys.platform == 'darwin':
from AppKit import NSWorkspace
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.api import BaseObserver
F_GLOBAL_NOCACHE = 55
elif sys.platform == 'win32':
@ -51,6 +52,7 @@ elif sys.platform == 'win32':
from watchdog.events import FileCreatedEvent, FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.api import BaseObserver
EnumWindows = ctypes.windll.user32.EnumWindows
EnumWindowsProc = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
@ -70,6 +72,7 @@ else:
# this isn't ever used, but this will make type checking happy
from watchdog.events import FileCreatedEvent
from watchdog.observers import Observer
from watchdog.observers.api import BaseObserver
# Journal handler
@ -91,7 +94,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.root: 'tkinter.Tk' = None # type: ignore # Don't use Optional[] - mypy thinks no methods
self.currentdir: str | None = None # The actual logdir that we're monitoring
self.logfile: str | None = None
self.observer: 'Observer' | None = None
self.observer: BaseObserver | None = None
self.observed = None # a watchdog ObservedWatch, or None if polling
self.thread: threading.Thread | None = None
# For communicating journal entries back to main thread