ruff format

This commit is contained in:
boyska 2024-11-20 17:22:05 +01:00
parent e52b08ace6
commit 15eeeccb4b

View file

@ -87,7 +87,7 @@ class ArchiveBackend:
self.dl_url = None # final download URL
def __str__(self):
return '<archive.org>'
return "<archive.org>"
@property
def auth_headers(self):
@ -126,7 +126,6 @@ class ArchiveBackend:
self.dl_url = f"https://archive.org/download/{self.bucket}/{filename.name}"
return self.dl_url
def copy(self, filename: Path, destination_path: bytes) -> str:
"""
destination_path is ignored
@ -155,7 +154,7 @@ class ArkiwiBackend(RcloneBackend):
self.prefix: bytes = prefix.strip("/").encode("utf8")
def __str__(self):
return '<www.arkiwi.org>'
return "<www.arkiwi.org>"
def ftp_path(self, path: bytes) -> bytes:
return b"ftp://upload.arkiwi.org/%s/" % (path.strip(b"/"),)
@ -224,7 +223,8 @@ def zenity_pulsate(args):
proc = subprocess.Popen(
["zenity", "--auto-close", "--progress", "--pulsate", *args],
universal_newlines=True,
stdin=subprocess.PIPE)
stdin=subprocess.PIPE,
)
try:
yield proc.stdin
finally:
@ -287,7 +287,7 @@ class Carichello:
)
if not output:
return 1
self.args.file = Path(output.rstrip('\n'))
self.args.file = Path(output.rstrip("\n"))
if not self.args.file.exists():
subprocess.run(
["zenity", "--error", f"--text=Il file '{self.args.file}' non esiste"]
@ -305,8 +305,12 @@ class Carichello:
url = None
LOG.info("file %s would be uploaded", str(self.args.file))
with zenity_pulsate([f"--title=Caricamento file su {backend}",
f"--text=Verifiche file {self.args.file.name} in corso..."]) as zenity:
with zenity_pulsate(
[
f"--title=Caricamento file su {backend}",
f"--text=Verifiche file {self.args.file.name} in corso...",
]
) as zenity:
try:
exists = backend.exists(dest_file)
except subprocess.CalledProcessError as exc:
@ -334,7 +338,9 @@ class Carichello:
if url:
self.set_clipboard(url)
text = f"Caricamento su {url} in corso... Copia l'indirizzo da usare: 📋"
text = (
f"Caricamento su {url} in corso... Copia l'indirizzo da usare: 📋"
)
else:
text = f"Caricamento {self.args.file.name} in corso..."
zenity.write(f"# {text}\n")