🎨 Apply black formatting
0
.github/workflows/pre-commit.yml
vendored
Normal file → Executable file
0
.github/workflows/pypi-publish.yml
vendored
Normal file → Executable file
0
.github/workflows/run-pytest.yml
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
8
.pre-commit-config.yaml
Normal file → Executable file
@ -1,5 +1,13 @@
|
|||||||
fail_fast: true
|
fail_fast: true
|
||||||
repos:
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: check-filenames
|
||||||
|
name: Check Python Filenames
|
||||||
|
entry: python ./.pre-commit/check_filename.py
|
||||||
|
language: python
|
||||||
|
files: \.py$
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 24.4.2
|
rev: 24.4.2
|
||||||
hooks:
|
hooks:
|
||||||
|
40
.pre-commit/check_filename.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def is_valid_filename(filename: str) -> bool:
|
||||||
|
"""文件名完整相对路径
|
||||||
|
|
||||||
|
Args:
|
||||||
|
filename (str): _description_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: _description_
|
||||||
|
"""
|
||||||
|
# 检查文件名是否仅包含小写字母,数字,下划线
|
||||||
|
if not re.match(r"^[a-z0-9_]+\.py$", filename):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
invalid_files = []
|
||||||
|
for root, _, files in os.walk("nonebot_plugin_marshoai"):
|
||||||
|
for file in files:
|
||||||
|
if file.endswith(".py"):
|
||||||
|
if not is_valid_filename(file):
|
||||||
|
invalid_files.append(os.path.join(root, file))
|
||||||
|
|
||||||
|
if invalid_files:
|
||||||
|
print("以下文件名不符合命名规则:")
|
||||||
|
for file in invalid_files:
|
||||||
|
print(file)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
0
LICENSE-MIT
Normal file → Executable file
0
LICENSE-MULAN
Normal file → Executable file
0
README_DEV.md
Normal file → Executable file
0
README_EN.md
Normal file → Executable file
0
README_TOOLS.md
Normal file → Executable file
0
README_TOOLS_EN.md
Normal file → Executable file
0
nonebot_plugin_marshoai/__init__.py
Normal file → Executable file
0
nonebot_plugin_marshoai/azure.py
Normal file → Executable file
0
nonebot_plugin_marshoai/azure_onebot.py
Normal file → Executable file
0
nonebot_plugin_marshoai/config.py
Normal file → Executable file
0
nonebot_plugin_marshoai/config_example.yaml
Normal file → Executable file
0
nonebot_plugin_marshoai/constants.py
Normal file → Executable file
0
nonebot_plugin_marshoai/deal_latex.py
Normal file → Executable file
0
nonebot_plugin_marshoai/hunyuan.py
Normal file → Executable file
0
nonebot_plugin_marshoai/metadata.py
Normal file → Executable file
0
nonebot_plugin_marshoai/models.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_bangumi/__init__.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_bangumi/tools.json
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_basic/__init__.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_basic/tools.json
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_basic/tools_test.json
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_megakits/mk_info.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_megakits/mk_morse_code.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_megakits/mk_nya_code.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_megakits/tools.json
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_meogirl/__init__.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_info.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_introduce.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_search.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools/marshoai_meogirl/tools.json
Normal file → Executable file
0
nonebot_plugin_marshoai/tools_wip/marshoai_memory/__init__.py
Normal file → Executable file
0
nonebot_plugin_marshoai/tools_wip/marshoai_memory/tools.json
Normal file → Executable file
0
nonebot_plugin_marshoai/util.py
Normal file → Executable file
0
nonebot_plugin_marshoai/util_hunyuan.py
Normal file → Executable file
0
pyproject.toml
Normal file → Executable file
0
resources/README.md
Normal file → Executable file
0
resources/bg.png
Normal file → Executable file
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
0
resources/catface.svg
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
resources/marsho-640x360.png
Normal file → Executable file
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
0
resources/marsho-bg-1x1.png
Normal file → Executable file
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
0
resources/marsho-bg.png
Normal file → Executable file
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
0
resources/marsho-icon.png
Normal file → Executable file
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
0
resources/marsho-icon.svg
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
0
resources/marsho-new.svg
Normal file → Executable file
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
0
resources/marsho-no-paw.png
Normal file → Executable file
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
0
resources/marsho-paw.png
Normal file → Executable file
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
0
resources/marsho.png
Normal file → Executable file
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
0
resources/marsho.svg
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |