99 lines
2.8 KiB
Diff
99 lines
2.8 KiB
Diff
From eb4caa96b870e0bb3da467968b096733cd2bb1f4 Mon Sep 17 00:00:00 2001
|
|
From: odrling <florianbadie@odrling.xyz>
|
|
Date: Fri, 22 Mar 2024 01:39:25 +0100
|
|
Subject: [PATCH] remove pyperclip
|
|
|
|
mostly useful to install on headless systems
|
|
---
|
|
hikari/hikari.py | 19 ++++---------------
|
|
pyproject.toml | 1 -
|
|
typings/pyperclip/__init__.pyi | 1 -
|
|
3 files changed, 4 insertions(+), 17 deletions(-)
|
|
delete mode 100644 typings/pyperclip/__init__.pyi
|
|
|
|
diff --git a/hikari/hikari.py b/hikari/hikari.py
|
|
index 222f064..66742bd 100755
|
|
--- a/hikari/hikari.py
|
|
+++ b/hikari/hikari.py
|
|
@@ -24,7 +24,6 @@ from pathlib import Path
|
|
from typing import Literal, Optional
|
|
|
|
import httpx
|
|
-import pyperclip
|
|
import typer
|
|
from rich.console import Console
|
|
from rich.progress import (
|
|
@@ -73,11 +72,8 @@ def check_hash(filename: str, file: Path):
|
|
return UploadResponse(**req.json())
|
|
|
|
|
|
-def output(copy: bool, resp: UploadResponse):
|
|
- if copy:
|
|
- pyperclip.copy(resp.url)
|
|
- action = "Copied"
|
|
- elif resp.status == "exists":
|
|
+def output(resp: UploadResponse):
|
|
+ if resp.status == "exists":
|
|
action = "Found"
|
|
elif resp.status == "uploaded":
|
|
action = "Uploaded"
|
|
@@ -134,26 +130,19 @@ def upload(file: Path,
|
|
None, "--name", "-n",
|
|
help="Rename the uploaded file."
|
|
),
|
|
- copy: bool = typer.Option(
|
|
- False, "--copy", "-c",
|
|
- help="Copy file URL to clipboard."
|
|
- ),
|
|
hash: bool = typer.Option(
|
|
True, "--hash/--no-hash", "-h/-H",
|
|
help="Check file hash before uploading."
|
|
)):
|
|
|
|
with get_client():
|
|
- if copy:
|
|
- pyperclip.copy("")
|
|
-
|
|
if obstruct:
|
|
filename = f"{hashlib.sha256(file.name.encode()).hexdigest()}{file.suffix}"
|
|
elif filename is None:
|
|
filename = file.name
|
|
|
|
if hash and (resp := check_hash(filename, file)):
|
|
- return output(copy, resp)
|
|
+ return output(resp)
|
|
|
|
with file.open('br') as f:
|
|
monitor = ProgressMonitor(filename, f)
|
|
@@ -164,7 +153,7 @@ def upload(file: Path,
|
|
|
|
req.raise_for_status()
|
|
data = UploadResponse(**req.json())
|
|
- output(copy, data)
|
|
+ output(data)
|
|
|
|
|
|
def main():
|
|
diff --git a/pyproject.toml b/pyproject.toml
|
|
index 22398fe..88ed4ff 100644
|
|
--- a/pyproject.toml
|
|
+++ b/pyproject.toml
|
|
@@ -7,7 +7,6 @@ name = "hikari"
|
|
dynamic = ["version"]
|
|
license = {file = "LICENSE"}
|
|
dependencies = [
|
|
- "pyperclip",
|
|
"httpx",
|
|
"rich",
|
|
"typer",
|
|
diff --git a/typings/pyperclip/__init__.pyi b/typings/pyperclip/__init__.pyi
|
|
deleted file mode 100644
|
|
index 86dc588..0000000
|
|
--- a/stubs/pyperclip/__init__.pyi
|
|
+++ /dev/null
|
|
@@ -1 +0,0 @@
|
|
-def copy(text: str) -> None: ...
|
|
--
|
|
2.44.0
|
|
|