From 64259596ff58a87d22f6e05b32d3cc4a297af67d Mon Sep 17 00:00:00 2001 From: cswimr Date: Fri, 29 Nov 2024 06:35:15 -0500 Subject: [PATCH] mypy fixes --- scripts/spectacle-screenshot.py | 10 +++++----- scripts/zipline.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/spectacle-screenshot.py b/scripts/spectacle-screenshot.py index 2a08cad..cc6d1fd 100755 --- a/scripts/spectacle-screenshot.py +++ b/scripts/spectacle-screenshot.py @@ -8,7 +8,7 @@ import tempfile from pathlib import Path from shutil import which -from common.common import notify +from common.common import notify # type: ignore def spectacle_screenshot( @@ -27,7 +27,7 @@ def spectacle_screenshot( use_temp_file = True suffix = ".webm" if record else ".png" temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix) - file_path = temp_file.name + file_path = Path(temp_file.name) temp_file.close() else: use_temp_file = False @@ -48,7 +48,7 @@ def spectacle_screenshot( command.append("--region") try: - subprocess.run(command, check=True) + subprocess.run(command, check=True) # type: ignore except subprocess.CalledProcessError as e: if Path(file_path).exists() and use_temp_file: os.remove(file_path) @@ -69,7 +69,7 @@ def spectacle_screenshot( ] if url: opts.extend(["--url", url]) - subprocess.run(opts) + subprocess.run(opts) # type: ignore finally: if Path(file_path).exists() and use_temp_file: os.remove(file_path) @@ -78,7 +78,7 @@ def spectacle_screenshot( application_name="Spectacle", title="An error occurred", message=str(e), - urgency="critical", + urgency="normal", category="transfer.error", desktop_entry="org.kde.spectacle", ) diff --git a/scripts/zipline.py b/scripts/zipline.py index 8d1e214..b6e0aa3 100755 --- a/scripts/zipline.py +++ b/scripts/zipline.py @@ -9,15 +9,19 @@ from shutil import which from typing import Any import requests # type: ignore -from common.common import does_desktop_entry_exist, notify, read_secret_file +from common.common import ( # type: ignore + does_desktop_entry_exist, + notify, + read_secret_file, +) from pyperclip import copy # type: ignore def zipline( file_path: Path, instance_url: str, - application_name: str = None, - desktop_entry: str = None, + application_name: str | None = None, + desktop_entry: str | None = None, ) -> Any: token = read_secret_file("zipline") @@ -72,7 +76,7 @@ def zipline( application_name=application_name, title="Upload Failed", message=f"An error occurred: {e}", - urgency="critical", + urgency="normal", category="transfer.error", icon=file_path, )