From 0410806152fbe324867e9bc1258b3211b409344a Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Sun, 14 Apr 2024 18:07:30 -0400 Subject: [PATCH 1/2] [2199] Add Broader Exception --- killswitch.py | 4 ++-- myNotebook.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/killswitch.py b/killswitch.py index 9cc407a61..89a55292f 100644 --- a/killswitch.py +++ b/killswitch.py @@ -361,8 +361,8 @@ def fetch_kill_switches(target=DEFAULT_KILLSWITCH_URL) -> KillSwitchJSONFile | N logger.warning(f"Failed to get kill switches, data was invalid: {e}") return None - except (requests.exceptions.BaseHTTPError, requests.exceptions.ConnectionError) as e: # type: ignore - logger.warning(f"unable to connect to {target!r}: {e}") + except requests.exceptions.RequestException as requ_err: + logger.warning(f"unable to connect to {target!r}: {requ_err}") return None return data diff --git a/myNotebook.py b/myNotebook.py index 0eeb96a48..88b4aec5e 100644 --- a/myNotebook.py +++ b/myNotebook.py @@ -63,11 +63,11 @@ def __init__(self, master: ttk.Frame | None = None, **kw): super().__init__(master, **kw) -class EntryMenu(ttk.Entry): +class EntryMenu: """Extended entry widget that includes a context menu with Copy, Cut-and-Paste commands.""" def __init__(self, *args, **kwargs) -> None: - super().__init__(*args, **kwargs) + ttk.Entry.__init__(self, *args, **kwargs) self.menu = tk.Menu(self, tearoff=False) self.menu.add_command(label="Copy", command=self.copy) @@ -120,7 +120,7 @@ def paste(self) -> None: pass -class Entry(ttk.Entry or EntryMenu): # type: ignore +class Entry(ttk.Entry, EntryMenu): """Custom t(t)k.Entry class to fix some display issues.""" # DEPRECATED: Migrate to ttk.Entry or EntryMenu. Will remove in 5.12 or later. From 5cc08f25175e6286f6012cc0b3c3311ec685f37d Mon Sep 17 00:00:00 2001 From: David Sangrey Date: Sun, 14 Apr 2024 20:32:43 -0400 Subject: [PATCH 2/2] [Minor] Clarify Inheritence --- myNotebook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/myNotebook.py b/myNotebook.py index 88b4aec5e..dd6e34290 100644 --- a/myNotebook.py +++ b/myNotebook.py @@ -63,7 +63,7 @@ def __init__(self, master: ttk.Frame | None = None, **kw): super().__init__(master, **kw) -class EntryMenu: +class EntryMenu(ttk.Entry): """Extended entry widget that includes a context menu with Copy, Cut-and-Paste commands.""" def __init__(self, *args, **kwargs) -> None: @@ -120,7 +120,7 @@ def paste(self) -> None: pass -class Entry(ttk.Entry, EntryMenu): +class Entry(EntryMenu): """Custom t(t)k.Entry class to fix some display issues.""" # DEPRECATED: Migrate to ttk.Entry or EntryMenu. Will remove in 5.12 or later.