Add YAPF style + ignore, and format tracked Python files
This commit is contained in:
@@ -19,15 +19,26 @@ class ZeroXZero(Provider):
|
||||
raise FileNotFoundError(f"File not found: {file_path}")
|
||||
|
||||
try:
|
||||
headers = {"User-Agent": "Medeia-Macina/1.0"}
|
||||
headers = {
|
||||
"User-Agent": "Medeia-Macina/1.0"
|
||||
}
|
||||
with HTTPClient(headers=headers) as client:
|
||||
with open(file_path, "rb") as handle:
|
||||
try:
|
||||
total = os.path.getsize(file_path)
|
||||
except Exception:
|
||||
total = None
|
||||
wrapped = ProgressFileReader(handle, total_bytes=total, label="upload")
|
||||
response = client.post("https://0x0.st", files={"file": wrapped})
|
||||
wrapped = ProgressFileReader(
|
||||
handle,
|
||||
total_bytes=total,
|
||||
label="upload"
|
||||
)
|
||||
response = client.post(
|
||||
"https://0x0.st",
|
||||
files={
|
||||
"file": wrapped
|
||||
}
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
uploaded_url = response.text.strip()
|
||||
@@ -36,15 +47,19 @@ class ZeroXZero(Provider):
|
||||
if pipe_obj is not None:
|
||||
from Store import Store
|
||||
|
||||
Store(self.config, suppress_debug=True).try_add_url_for_pipe_object(
|
||||
pipe_obj, uploaded_url
|
||||
)
|
||||
Store(
|
||||
self.config,
|
||||
suppress_debug=True
|
||||
).try_add_url_for_pipe_object(pipe_obj,
|
||||
uploaded_url)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return uploaded_url
|
||||
|
||||
raise Exception(f"Upload failed: {response.status_code} - {response.text}")
|
||||
raise Exception(
|
||||
f"Upload failed: {response.status_code} - {response.text}"
|
||||
)
|
||||
|
||||
except Exception as exc:
|
||||
log(f"[0x0] Upload error: {exc}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user