ruff format
This commit is contained in:
parent
e52b08ace6
commit
15eeeccb4b
1 changed files with 16 additions and 10 deletions
|
@ -87,7 +87,7 @@ class ArchiveBackend:
|
||||||
self.dl_url = None # final download URL
|
self.dl_url = None # final download URL
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '<archive.org>'
|
return "<archive.org>"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def auth_headers(self):
|
def auth_headers(self):
|
||||||
|
@ -126,7 +126,6 @@ class ArchiveBackend:
|
||||||
self.dl_url = f"https://archive.org/download/{self.bucket}/{filename.name}"
|
self.dl_url = f"https://archive.org/download/{self.bucket}/{filename.name}"
|
||||||
return self.dl_url
|
return self.dl_url
|
||||||
|
|
||||||
|
|
||||||
def copy(self, filename: Path, destination_path: bytes) -> str:
|
def copy(self, filename: Path, destination_path: bytes) -> str:
|
||||||
"""
|
"""
|
||||||
destination_path is ignored
|
destination_path is ignored
|
||||||
|
@ -155,7 +154,7 @@ class ArkiwiBackend(RcloneBackend):
|
||||||
self.prefix: bytes = prefix.strip("/").encode("utf8")
|
self.prefix: bytes = prefix.strip("/").encode("utf8")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '<www.arkiwi.org>'
|
return "<www.arkiwi.org>"
|
||||||
|
|
||||||
def ftp_path(self, path: bytes) -> bytes:
|
def ftp_path(self, path: bytes) -> bytes:
|
||||||
return b"ftp://upload.arkiwi.org/%s/" % (path.strip(b"/"),)
|
return b"ftp://upload.arkiwi.org/%s/" % (path.strip(b"/"),)
|
||||||
|
@ -222,9 +221,10 @@ BACKENDS = {
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def zenity_pulsate(args):
|
def zenity_pulsate(args):
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
["zenity", "--auto-close", "--progress", "--pulsate", *args],
|
["zenity", "--auto-close", "--progress", "--pulsate", *args],
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
stdin=subprocess.PIPE)
|
stdin=subprocess.PIPE,
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
yield proc.stdin
|
yield proc.stdin
|
||||||
finally:
|
finally:
|
||||||
|
@ -287,7 +287,7 @@ class Carichello:
|
||||||
)
|
)
|
||||||
if not output:
|
if not output:
|
||||||
return 1
|
return 1
|
||||||
self.args.file = Path(output.rstrip('\n'))
|
self.args.file = Path(output.rstrip("\n"))
|
||||||
if not self.args.file.exists():
|
if not self.args.file.exists():
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["zenity", "--error", f"--text=Il file '{self.args.file}' non esiste"]
|
["zenity", "--error", f"--text=Il file '{self.args.file}' non esiste"]
|
||||||
|
@ -305,8 +305,12 @@ class Carichello:
|
||||||
url = None
|
url = None
|
||||||
LOG.info("file %s would be uploaded", str(self.args.file))
|
LOG.info("file %s would be uploaded", str(self.args.file))
|
||||||
|
|
||||||
with zenity_pulsate([f"--title=Caricamento file su {backend}",
|
with zenity_pulsate(
|
||||||
f"--text=Verifiche file {self.args.file.name} in corso..."]) as zenity:
|
[
|
||||||
|
f"--title=Caricamento file su {backend}",
|
||||||
|
f"--text=Verifiche file {self.args.file.name} in corso...",
|
||||||
|
]
|
||||||
|
) as zenity:
|
||||||
try:
|
try:
|
||||||
exists = backend.exists(dest_file)
|
exists = backend.exists(dest_file)
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
|
@ -334,7 +338,9 @@ class Carichello:
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
self.set_clipboard(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:
|
else:
|
||||||
text = f"Caricamento {self.args.file.name} in corso..."
|
text = f"Caricamento {self.args.file.name} in corso..."
|
||||||
zenity.write(f"# {text}\n")
|
zenity.write(f"# {text}\n")
|
||||||
|
|
Loading…
Reference in a new issue