From ca915782f678101ee0e987a2d21345c7ec99e527 Mon Sep 17 00:00:00 2001 From: A_D Date: Fri, 23 Dec 2022 19:01:02 +0200 Subject: [PATCH] hotkey: add sys.platform guards to all files This both makes mypy happy and ensures that the wrong file is not imported in the wrong place --- hotkey/darwin.py | 3 ++- hotkey/linux.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hotkey/darwin.py b/hotkey/darwin.py index a053a55f..cbf9d260 100644 --- a/hotkey/darwin.py +++ b/hotkey/darwin.py @@ -3,6 +3,7 @@ import pathlib import sys import tkinter as tk from typing import Callable, Optional, Tuple, Union +assert sys.platform == 'darwin' import objc from AppKit import ( @@ -36,7 +37,7 @@ class MacHotkeyMgr(AbstractHotkeyMgr): def __init__(self): self.MODIFIERMASK = NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask \ - | NSNumericPadKeyMask + | NSNumericPadKeyMask self.root: tk.Tk self.keycode = 0 diff --git a/hotkey/linux.py b/hotkey/linux.py index 5074c319..927c4d26 100644 --- a/hotkey/linux.py +++ b/hotkey/linux.py @@ -1,7 +1,11 @@ """Linux implementation of hotkey.AbstractHotkeyMgr.""" +import sys + from EDMCLogging import get_main_logger from hotkey import AbstractHotkeyMgr +assert sys.platform == 'linux' + logger = get_main_logger()