mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 13:42: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:
|
||||
autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks"
|
||||
autofix_prs: true
|
||||
autoupdate_branch: master
|
||||
autoupdate_branch: main
|
||||
autoupdate_schedule: monthly
|
||||
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.8.1
|
||||
rev: v0.8.2
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix]
|
||||
|
||||
2
bot.py
2
bot.py
@ -14,7 +14,7 @@ driver.register_adapter(KaiheilaAdapter)
|
||||
driver.register_adapter(DoDoAdapter)
|
||||
# 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_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
|
||||
|
||||
[[tool.poetry.source]]
|
||||
name = "ali"
|
||||
default = true
|
||||
name = "aliyun"
|
||||
url = "https://mirrors.aliyun.com/pypi/simple/"
|
||||
priority = "primary"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
@ -38,10 +38,8 @@ beautifulsoup4 = "^4.12.3"
|
||||
lxml = "^5.1.0"
|
||||
psutil = "^5.9.8"
|
||||
feedparser = "^6.0.11"
|
||||
opencv-python = "^4.9.0.80"
|
||||
imagehash = "^4.3.1"
|
||||
cn2an = "^0.5.22"
|
||||
aiohttp = "^3.9.5"
|
||||
dateparser = "^1.2.0"
|
||||
bilireq = "0.2.3post0"
|
||||
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 re
|
||||
|
||||
import cv2
|
||||
import imagehash
|
||||
from nonebot.utils import is_coroutine_callable
|
||||
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.utils.http_utils import AsyncHttpx
|
||||
|
||||
@ -347,30 +346,6 @@ async def build_sort_image(
|
||||
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:
|
||||
"""获取图片的hash值
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user