From 53d9cfb15ade8a37ff4eeebcef6c48058e4dc177 Mon Sep 17 00:00:00 2001 From: Snowykami Date: Sat, 14 Dec 2024 01:15:29 +0800 Subject: [PATCH] :art: Apply black formatting --- .github/workflows/pre-commit.yml | 0 .github/workflows/pypi-publish.yml | 0 .github/workflows/run-pytest.yml | 0 .gitignore | 0 .pre-commit-config.yaml | 8 ++++ .pre-commit/check_filename.py | 40 ++++++++++++++++++ LICENSE-MIT | 0 LICENSE-MULAN | 0 README.md | 0 README_DEV.md | 0 README_EN.md | 0 README_TOOLS.md | 0 README_TOOLS_EN.md | 0 nonebot_plugin_marshoai/__init__.py | 0 nonebot_plugin_marshoai/azure.py | 0 nonebot_plugin_marshoai/azure_onebot.py | 0 nonebot_plugin_marshoai/config.py | 0 nonebot_plugin_marshoai/config_example.yaml | 0 nonebot_plugin_marshoai/constants.py | 0 nonebot_plugin_marshoai/deal_latex.py | 0 nonebot_plugin_marshoai/hunyuan.py | 0 nonebot_plugin_marshoai/metadata.py | 0 nonebot_plugin_marshoai/models.py | 0 .../tools/marshoai_bangumi/__init__.py | 0 .../tools/marshoai_bangumi/tools.json | 0 .../tools/marshoai_basic/__init__.py | 0 .../tools/marshoai_basic/tools.json | 0 .../tools/marshoai_basic/tools_test.json | 0 .../tools/marshoai_megakits/__init__.py | 0 .../tools/marshoai_megakits/mk_common.py | 0 .../tools/marshoai_megakits/mk_info.py | 0 .../tools/marshoai_megakits/mk_morse_code.py | 0 .../tools/marshoai_megakits/mk_nya_code.py | 0 .../tools/marshoai_megakits/tools.json | 0 .../tools/marshoai_meogirl/__init__.py | 0 .../tools/marshoai_meogirl/mg_info.py | 0 .../tools/marshoai_meogirl/mg_introduce.py | 0 .../tools/marshoai_meogirl/mg_search.py | 0 .../tools/marshoai_meogirl/tools.json | 0 .../tools_wip/marshoai_memory/__init__.py | 0 .../tools_wip/marshoai_memory/tools.json | 0 nonebot_plugin_marshoai/util.py | 0 nonebot_plugin_marshoai/util_hunyuan.py | 0 pyproject.toml | 0 resources/README.md | 0 resources/bg.png | Bin resources/catface.svg | 0 resources/marsho-640x360.png | Bin resources/marsho-bg-1x1.png | Bin resources/marsho-bg.png | Bin resources/marsho-icon.png | Bin resources/marsho-icon.svg | 0 resources/marsho-new.svg | 0 resources/marsho-no-paw.png | Bin resources/marsho-paw.png | Bin resources/marsho.png | Bin resources/marsho.svg | 0 tests/test_none.py | 0 58 files changed, 48 insertions(+) mode change 100644 => 100755 .github/workflows/pre-commit.yml mode change 100644 => 100755 .github/workflows/pypi-publish.yml mode change 100644 => 100755 .github/workflows/run-pytest.yml mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .pre-commit-config.yaml create mode 100644 .pre-commit/check_filename.py mode change 100644 => 100755 LICENSE-MIT mode change 100644 => 100755 LICENSE-MULAN mode change 100644 => 100755 README.md mode change 100644 => 100755 README_DEV.md mode change 100644 => 100755 README_EN.md mode change 100644 => 100755 README_TOOLS.md mode change 100644 => 100755 README_TOOLS_EN.md mode change 100644 => 100755 nonebot_plugin_marshoai/__init__.py mode change 100644 => 100755 nonebot_plugin_marshoai/azure.py mode change 100644 => 100755 nonebot_plugin_marshoai/azure_onebot.py mode change 100644 => 100755 nonebot_plugin_marshoai/config.py mode change 100644 => 100755 nonebot_plugin_marshoai/config_example.yaml mode change 100644 => 100755 nonebot_plugin_marshoai/constants.py mode change 100644 => 100755 nonebot_plugin_marshoai/deal_latex.py mode change 100644 => 100755 nonebot_plugin_marshoai/hunyuan.py mode change 100644 => 100755 nonebot_plugin_marshoai/metadata.py mode change 100644 => 100755 nonebot_plugin_marshoai/models.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_bangumi/__init__.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_bangumi/tools.json mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_basic/__init__.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_basic/tools.json mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_basic/tools_test.json mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_megakits/mk_info.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_megakits/mk_morse_code.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_megakits/mk_nya_code.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_megakits/tools.json mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_meogirl/__init__.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_info.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_introduce.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_search.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools/marshoai_meogirl/tools.json mode change 100644 => 100755 nonebot_plugin_marshoai/tools_wip/marshoai_memory/__init__.py mode change 100644 => 100755 nonebot_plugin_marshoai/tools_wip/marshoai_memory/tools.json mode change 100644 => 100755 nonebot_plugin_marshoai/util.py mode change 100644 => 100755 nonebot_plugin_marshoai/util_hunyuan.py mode change 100644 => 100755 pyproject.toml mode change 100644 => 100755 resources/README.md mode change 100644 => 100755 resources/bg.png mode change 100644 => 100755 resources/catface.svg mode change 100644 => 100755 resources/marsho-640x360.png mode change 100644 => 100755 resources/marsho-bg-1x1.png mode change 100644 => 100755 resources/marsho-bg.png mode change 100644 => 100755 resources/marsho-icon.png mode change 100644 => 100755 resources/marsho-icon.svg mode change 100644 => 100755 resources/marsho-new.svg mode change 100644 => 100755 resources/marsho-no-paw.png mode change 100644 => 100755 resources/marsho-paw.png mode change 100644 => 100755 resources/marsho.png mode change 100644 => 100755 resources/marsho.svg mode change 100644 => 100755 tests/test_none.py diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 index a004f6bc..5191ffd6 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,13 @@ fail_fast: true 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 rev: 24.4.2 hooks: diff --git a/.pre-commit/check_filename.py b/.pre-commit/check_filename.py new file mode 100644 index 00000000..d7f2e108 --- /dev/null +++ b/.pre-commit/check_filename.py @@ -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() diff --git a/LICENSE-MIT b/LICENSE-MIT old mode 100644 new mode 100755 diff --git a/LICENSE-MULAN b/LICENSE-MULAN old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/README_DEV.md b/README_DEV.md old mode 100644 new mode 100755 diff --git a/README_EN.md b/README_EN.md old mode 100644 new mode 100755 diff --git a/README_TOOLS.md b/README_TOOLS.md old mode 100644 new mode 100755 diff --git a/README_TOOLS_EN.md b/README_TOOLS_EN.md old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/__init__.py b/nonebot_plugin_marshoai/__init__.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/azure.py b/nonebot_plugin_marshoai/azure.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/azure_onebot.py b/nonebot_plugin_marshoai/azure_onebot.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/config.py b/nonebot_plugin_marshoai/config.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/config_example.yaml b/nonebot_plugin_marshoai/config_example.yaml old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/constants.py b/nonebot_plugin_marshoai/constants.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/deal_latex.py b/nonebot_plugin_marshoai/deal_latex.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/hunyuan.py b/nonebot_plugin_marshoai/hunyuan.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/metadata.py b/nonebot_plugin_marshoai/metadata.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/models.py b/nonebot_plugin_marshoai/models.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_bangumi/__init__.py b/nonebot_plugin_marshoai/tools/marshoai_bangumi/__init__.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_bangumi/tools.json b/nonebot_plugin_marshoai/tools/marshoai_bangumi/tools.json old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_basic/__init__.py b/nonebot_plugin_marshoai/tools/marshoai_basic/__init__.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_basic/tools.json b/nonebot_plugin_marshoai/tools/marshoai_basic/tools.json old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_basic/tools_test.json b/nonebot_plugin_marshoai/tools/marshoai_basic/tools_test.json old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py b/nonebot_plugin_marshoai/tools/marshoai_megakits/__init__.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py b/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_common.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_info.py b/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_info.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_morse_code.py b/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_morse_code.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_nya_code.py b/nonebot_plugin_marshoai/tools/marshoai_megakits/mk_nya_code.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_megakits/tools.json b/nonebot_plugin_marshoai/tools/marshoai_megakits/tools.json old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_meogirl/__init__.py b/nonebot_plugin_marshoai/tools/marshoai_meogirl/__init__.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_info.py b/nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_info.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_introduce.py b/nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_introduce.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_search.py b/nonebot_plugin_marshoai/tools/marshoai_meogirl/mg_search.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools/marshoai_meogirl/tools.json b/nonebot_plugin_marshoai/tools/marshoai_meogirl/tools.json old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools_wip/marshoai_memory/__init__.py b/nonebot_plugin_marshoai/tools_wip/marshoai_memory/__init__.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/tools_wip/marshoai_memory/tools.json b/nonebot_plugin_marshoai/tools_wip/marshoai_memory/tools.json old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/util.py b/nonebot_plugin_marshoai/util.py old mode 100644 new mode 100755 diff --git a/nonebot_plugin_marshoai/util_hunyuan.py b/nonebot_plugin_marshoai/util_hunyuan.py old mode 100644 new mode 100755 diff --git a/pyproject.toml b/pyproject.toml old mode 100644 new mode 100755 diff --git a/resources/README.md b/resources/README.md old mode 100644 new mode 100755 diff --git a/resources/bg.png b/resources/bg.png old mode 100644 new mode 100755 diff --git a/resources/catface.svg b/resources/catface.svg old mode 100644 new mode 100755 diff --git a/resources/marsho-640x360.png b/resources/marsho-640x360.png old mode 100644 new mode 100755 diff --git a/resources/marsho-bg-1x1.png b/resources/marsho-bg-1x1.png old mode 100644 new mode 100755 diff --git a/resources/marsho-bg.png b/resources/marsho-bg.png old mode 100644 new mode 100755 diff --git a/resources/marsho-icon.png b/resources/marsho-icon.png old mode 100644 new mode 100755 diff --git a/resources/marsho-icon.svg b/resources/marsho-icon.svg old mode 100644 new mode 100755 diff --git a/resources/marsho-new.svg b/resources/marsho-new.svg old mode 100644 new mode 100755 diff --git a/resources/marsho-no-paw.png b/resources/marsho-no-paw.png old mode 100644 new mode 100755 diff --git a/resources/marsho-paw.png b/resources/marsho-paw.png old mode 100644 new mode 100755 diff --git a/resources/marsho.png b/resources/marsho.png old mode 100644 new mode 100755 diff --git a/resources/marsho.svg b/resources/marsho.svg old mode 100644 new mode 100755 diff --git a/tests/test_none.py b/tests/test_none.py old mode 100644 new mode 100755