mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
chore/cleanup-dependencies (#1763)
* ➖ 移除opencv-python, aiohttp依赖,更新poetry.source配置格式 * 💚 更新pre-commit配置文件 * 🚨 移除无用导入
This commit is contained in:
parent
b6964a92fa
commit
b010eac041
@ -2,12 +2,12 @@ default_install_hook_types: [pre-commit]
|
|||||||
ci:
|
ci:
|
||||||
autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks"
|
autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks"
|
||||||
autofix_prs: true
|
autofix_prs: true
|
||||||
autoupdate_branch: master
|
autoupdate_branch: main
|
||||||
autoupdate_schedule: monthly
|
autoupdate_schedule: monthly
|
||||||
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.8.1
|
rev: v0.8.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix]
|
args: [--fix]
|
||||||
|
|||||||
2
bot.py
2
bot.py
@ -14,7 +14,7 @@ driver.register_adapter(KaiheilaAdapter)
|
|||||||
driver.register_adapter(DoDoAdapter)
|
driver.register_adapter(DoDoAdapter)
|
||||||
# driver.register_adapter(DiscordAdapter)
|
# driver.register_adapter(DiscordAdapter)
|
||||||
|
|
||||||
from zhenxun.services.db_context import init, disconnect
|
from zhenxun.services.db_context import disconnect, init
|
||||||
|
|
||||||
driver.on_startup(init)
|
driver.on_startup(init)
|
||||||
driver.on_shutdown(disconnect)
|
driver.on_shutdown(disconnect)
|
||||||
|
|||||||
1768
poetry.lock
generated
1768
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -7,9 +7,9 @@ license = "AGPL"
|
|||||||
package-mode = false
|
package-mode = false
|
||||||
|
|
||||||
[[tool.poetry.source]]
|
[[tool.poetry.source]]
|
||||||
name = "ali"
|
name = "aliyun"
|
||||||
default = true
|
|
||||||
url = "https://mirrors.aliyun.com/pypi/simple/"
|
url = "https://mirrors.aliyun.com/pypi/simple/"
|
||||||
|
priority = "primary"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.10"
|
python = "^3.10"
|
||||||
@ -38,10 +38,8 @@ beautifulsoup4 = "^4.12.3"
|
|||||||
lxml = "^5.1.0"
|
lxml = "^5.1.0"
|
||||||
psutil = "^5.9.8"
|
psutil = "^5.9.8"
|
||||||
feedparser = "^6.0.11"
|
feedparser = "^6.0.11"
|
||||||
opencv-python = "^4.9.0.80"
|
|
||||||
imagehash = "^4.3.1"
|
imagehash = "^4.3.1"
|
||||||
cn2an = "^0.5.22"
|
cn2an = "^0.5.22"
|
||||||
aiohttp = "^3.9.5"
|
|
||||||
dateparser = "^1.2.0"
|
dateparser = "^1.2.0"
|
||||||
bilireq = "0.2.3post0"
|
bilireq = "0.2.3post0"
|
||||||
python-jose = { extras = ["cryptography"], version = "^3.3.0" }
|
python-jose = { extras = ["cryptography"], version = "^3.3.0" }
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@ -5,12 +5,11 @@ from pathlib import Path
|
|||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import cv2
|
|
||||||
import imagehash
|
import imagehash
|
||||||
from nonebot.utils import is_coroutine_callable
|
from nonebot.utils import is_coroutine_callable
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from zhenxun.configs.path_config import IMAGE_PATH, TEMP_PATH
|
from zhenxun.configs.path_config import TEMP_PATH
|
||||||
from zhenxun.services.log import logger
|
from zhenxun.services.log import logger
|
||||||
from zhenxun.utils.http_utils import AsyncHttpx
|
from zhenxun.utils.http_utils import AsyncHttpx
|
||||||
|
|
||||||
@ -347,30 +346,6 @@ async def build_sort_image(
|
|||||||
return A
|
return A
|
||||||
|
|
||||||
|
|
||||||
def compressed_image(
|
|
||||||
in_file: str | Path,
|
|
||||||
out_file: str | Path | None = None,
|
|
||||||
ratio: float = 0.9,
|
|
||||||
):
|
|
||||||
"""压缩图片
|
|
||||||
|
|
||||||
参数:
|
|
||||||
in_file: 被压缩的文件路径
|
|
||||||
out_file: 压缩后输出的文件路径
|
|
||||||
ratio: 压缩率,宽高 * 压缩率
|
|
||||||
"""
|
|
||||||
in_file = IMAGE_PATH / in_file if isinstance(in_file, str) else in_file
|
|
||||||
if out_file:
|
|
||||||
out_file = IMAGE_PATH / out_file if isinstance(out_file, str) else out_file
|
|
||||||
else:
|
|
||||||
out_file = in_file
|
|
||||||
h, w, d = cv2.imread(str(in_file.absolute())).shape
|
|
||||||
img = cv2.resize(
|
|
||||||
cv2.imread(str(in_file.absolute())), (int(w * ratio), int(h * ratio))
|
|
||||||
)
|
|
||||||
cv2.imwrite(str(out_file.absolute()), img)
|
|
||||||
|
|
||||||
|
|
||||||
def get_img_hash(image_file: str | Path) -> str:
|
def get_img_hash(image_file: str | Path) -> str:
|
||||||
"""获取图片的hash值
|
"""获取图片的hash值
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user