From e45a89d97016dceaea1c647f9fda634cee8ab693 Mon Sep 17 00:00:00 2001
From: Athanasius <Athanasius@miggy.org>
Date: Thu, 22 Dec 2022 17:03:07 +0000
Subject: [PATCH] EDMarketConnector.py: Minor type fixes & ttkHyperlink.py too

---
 EDMarketConnector.py | 10 +++++++---
 ttkHyperlinkLabel.py |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/EDMarketConnector.py b/EDMarketConnector.py
index bed58e99..11f103b4 100755
--- a/EDMarketConnector.py
+++ b/EDMarketConnector.py
@@ -16,7 +16,7 @@ from builtins import object, str
 from os import chdir, environ
 from os.path import dirname, join
 from time import localtime, strftime, time
-from typing import TYPE_CHECKING, Literal, Optional, Tuple, Union
+from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple, Union
 
 # Have this as early as possible for people running EDMarketConnector.exe
 # from cmd.exe or a bat file or similar.  Else they might not be in the correct
@@ -592,7 +592,7 @@ class AppWindow(object):
 
         # The type needs defining for adding the menu entry, but won't be
         # properly set until later
-        self.updater: update.Updater = None
+        self.updater: update.Updater | None = None
 
         self.menubar = tk.Menu()
         if sys.platform == 'darwin':
@@ -647,7 +647,9 @@ class AppWindow(object):
             self.help_menu.add_command(command=self.help_general)
             self.help_menu.add_command(command=self.help_privacy)
             self.help_menu.add_command(command=self.help_releases)
-            self.help_menu.add_command(command=lambda: self.updater.check_for_updates())
+            if self.updater is not None:
+                self.help_menu.add_command(command=lambda: self.updater.check_for_updates())
+
             self.help_menu.add_command(command=lambda: not self.HelpAbout.showing and self.HelpAbout(self.w))
 
             self.menubar.add_cascade(menu=self.help_menu)
@@ -1005,6 +1007,8 @@ class AppWindow(object):
         :param event: Tk generated event details.
         """
         logger.trace_if('capi.worker', 'Begin')
+        should_return: bool
+        new_data: Dict[str, Any]
         should_return, new_data = killswitch.check_killswitch('capi.auth', {})
         if should_return:
             logger.warning('capi.auth has been disabled via killswitch. Returning.')
diff --git a/ttkHyperlinkLabel.py b/ttkHyperlinkLabel.py
index 43071732..44cd38b0 100644
--- a/ttkHyperlinkLabel.py
+++ b/ttkHyperlinkLabel.py
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
 class HyperlinkLabel(sys.platform == 'darwin' and tk.Label or ttk.Label, object):  # type: ignore
     """Clickable label for HTTP links."""
 
-    def __init__(self, master: Optional[tk.Tk] = None, **kw: Any) -> None:
+    def __init__(self, master: tk.Frame | None = None, **kw: Any) -> None:
         self.url = 'url' in kw and kw.pop('url') or None
         self.popup_copy = kw.pop('popup_copy', False)
         self.underline = kw.pop('underline', None)  # override ttk.Label's underline