Skip to content

Commit

Permalink
Annotations: add more annotations to ones with None value. Re #155.
Browse files Browse the repository at this point in the history
Some module-level variables are initialized to None, including library scan monitor thread, SPLConfig itself, and early metadata announcer timer. Therefore annotate these.
  • Loading branch information
josephsl committed Jan 23, 2021
1 parent 4f8d0b4 commit 469fc88
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions addon/appModules/splstudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def new(*args, **kwargs):
# Threads pool.
micAlarmT: Optional[threading.Timer] = None
micAlarmT2 = None
libScanT = None
libScanT: Optional[threading.Thread] = None

# Versions of Studio where library scanning functionality is broken.
noLibScanMonitor: list[str] = []
Expand Down Expand Up @@ -670,7 +670,7 @@ class AppModule(appModuleHandler.AppModule):

# Translators: Script category for StationPlaylist add-on commands in input gestures dialog.
scriptCategory = _("StationPlaylist")
_focusedTrack = None
_focusedTrack: Optional[Any] = None
# Monitor Studio API routines.
_SPLStudioMonitor = None

Expand Down
3 changes: 2 additions & 1 deletion addon/appModules/splstudio/splbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

# Base services for Studio app module and support modules

from typing import Optional
import ui
from winUser import sendMessage, user32
from logHandler import log
import addonHandler
addonHandler.initTranslation()

# Cache the handle to main Studio window.
_SPLWin = None
_SPLWin: Optional[int] = None


# Check if Studio itself is running.
Expand Down
2 changes: 1 addition & 1 deletion addon/appModules/splstudio/splconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Configuration management
SPLIni = os.path.join(globalVars.appArgs.configPath, "splstudio.ini")
SPLProfiles = os.path.join(globalVars.appArgs.configPath, "addons", "stationPlaylist", "profiles")
SPLConfig = None
SPLConfig: Optional[ConfigHub] = None
# Cache a copy of the loaded config.
# This comes in handy when saving configuration to disk. For the most part, no change occurs to config.
# This helps prolong life of a solid-state drive (preventing unnecessary writes).
Expand Down
3 changes: 2 additions & 1 deletion addon/appModules/splstudio/splmisc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# #155 (21.03): remove __future__ import when NVDA runs under Python 3.10.
from __future__ import annotations
from typing import Optional
import weakref
import os
import threading
Expand Down Expand Up @@ -452,7 +453,7 @@ def metadataStatus():


# Handle a case where instant profile ssitch occurs twice within the switch time-out.
_earlyMetadataAnnouncer = None
_earlyMetadataAnnouncer: Optional[threading.Timer] = None


# Internal metadata status announcer.
Expand Down

0 comments on commit 469fc88

Please sign in to comment.