mypy fixes
This commit is contained in:
parent
6838797fdf
commit
64259596ff
2 changed files with 13 additions and 9 deletions
|
@ -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",
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue