From f2867deb2fb90603ad17c5829aecb95a7609f6e4 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Wed, 3 Jul 2024 18:03:41 +0100 Subject: [PATCH] mypy linting --- app/dialogs.py | 4 ++-- app/helpers.py | 1 + app/musicmuster.py | 4 ++-- app/trackmanager.py | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/dialogs.py b/app/dialogs.py index 5ebd08f..85c3945 100644 --- a/app/dialogs.py +++ b/app/dialogs.py @@ -386,12 +386,12 @@ class TrackSelectDialog(QDialog): event.accept() - def keyPressEvent(self, event: QKeyEvent) -> None: + def keyPressEvent(self, event: QKeyEvent | None) -> None: """ Clear selection on ESC if there is one """ - if event.key() == Qt.Key.Key_Escape: + if event and event.key() == Qt.Key.Key_Escape: if self.ui.matchList.selectedItems(): self.ui.matchList.clearSelection() return diff --git a/app/helpers.py b/app/helpers.py index 2803e00..9a25e17 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -305,6 +305,7 @@ def normalise_track(path: str) -> None: os.chown(path, stats.st_uid, stats.st_gid) os.chmod(path, stats.st_mode) # Copy tags + tag_handler: type[FLAC | MP3] if ftype == "flac": tag_handler = FLAC elif ftype == "mp3": diff --git a/app/musicmuster.py b/app/musicmuster.py index 1cff60d..e108069 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -1816,8 +1816,8 @@ if __name__ == "__main__": msg = stackprinter.format(exc) send_mail( - Config.ERRORS_TO, - Config.ERRORS_FROM, + ",".join(Config.ERRORS_TO), + ",".join(Config.ERRORS_FROM), "Exception from musicmuster", msg, ) diff --git a/app/trackmanager.py b/app/trackmanager.py index 7312cbb..9577589 100644 --- a/app/trackmanager.py +++ b/app/trackmanager.py @@ -103,8 +103,9 @@ class _FadeCurve: self.GraphWidget.clear() def plot(self) -> None: - self.curve = self.GraphWidget.plot(self.graph_array) - self.curve.setPen(Config.FADE_CURVE_FOREGROUND) + if self.GraphWidget: + self.curve = self.GraphWidget.plot(self.graph_array) + self.curve.setPen(Config.FADE_CURVE_FOREGROUND) def tick(self, play_time) -> None: """Update volume fade curve"""