From 93aec6d3f6a570b7727739465fc11ae4cf48b2da Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sat, 15 Jan 2022 21:27:43 +0800 Subject: [PATCH] :label: add pre-commit flow --- .github/release-drafter.yml | 42 +++--- .github/workflows/website-deploy.yml | 4 +- .pre-commit-config.yaml | 20 +++ docs_build/conf.py | 30 ++--- nonebot/adapters/_adapter.py | 3 +- nonebot/adapters/_event.py | 3 +- nonebot/dependencies/__init__.py | 3 +- nonebot/drivers/__init__.py | 7 +- nonebot/drivers/fastapi.py | 3 +- nonebot/drivers/quart.py | 3 +- nonebot/plugin/manager.py | 1 + nonebot/plugin/on.py | 3 +- nonebot/plugin/plugin.py | 3 +- .../nonebot_plugin_docs/drivers/fastapi.py | 3 +- poetry.lock | 125 +++++++++++++++++- pyproject.toml | 3 +- tests/.isort.cfg | 8 -- tests/plugins/require.py | 2 +- tests/test_matcher.py | 1 - tests/test_param.py | 8 -- website/babel.config.js | 2 +- website/docusaurus.config.js | 2 +- .../src/components/Paginate/styles.module.css | 1 - website/static/plugins.json | 2 +- website/static/unregister-sw.js | 17 ++- website/versions.json | 4 +- 26 files changed, 226 insertions(+), 77 deletions(-) create mode 100644 .pre-commit-config.yaml delete mode 100644 tests/.isort.cfg diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 29ddb22f..60eeb6f8 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,36 +1,36 @@ -name-template: 'Release v$RESOLVED_VERSION 🌈' -tag-template: 'v$RESOLVED_VERSION' +name-template: "Release v$RESOLVED_VERSION 🌈" +tag-template: "v$RESOLVED_VERSION" categories: - - title: 'đŸ’„ Breaking Changes' + - title: "đŸ’„ Breaking Changes" labels: - - 'Breaking' - - title: '🚀 Features' + - "Breaking" + - title: "🚀 Features" labels: - - 'feature' - - 'enhancement' - - title: '🐛 Bug Fixes' + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" labels: - - 'fix' - - 'bugfix' - - 'bug' - - title: 'đŸ» Plugin Publish' - label: 'Plugin' - - title: 'đŸ» Bot Publish' - label: 'Bot' - - title: 'đŸ» Adapter Publish' - label: 'Adapter' -change-template: '- $TITLE @$AUTHOR (#$NUMBER)' + - "fix" + - "bugfix" + - "bug" + - title: "đŸ» Plugin Publish" + label: "Plugin" + - title: "đŸ» Bot Publish" + label: "Bot" + - title: "đŸ» Adapter Publish" + label: "Adapter" +change-template: "- $TITLE @$AUTHOR (#$NUMBER)" change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: major: labels: - - 'major' + - "major" minor: labels: - - 'minor' + - "minor" patch: labels: - - 'patch' + - "patch" default: patch template: | ## Documentation diff --git a/.github/workflows/website-deploy.yml b/.github/workflows/website-deploy.yml index 16b301f2..7fb1a449 100644 --- a/.github/workflows/website-deploy.yml +++ b/.github/workflows/website-deploy.yml @@ -48,10 +48,10 @@ jobs: - name: Deploy to Netlify uses: nwtgck/actions-netlify@v1 with: - publish-dir: './website/build' + publish-dir: "./website/build" production-deploy: ${{ env.PRODUCTION }} github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: 'Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}' + deploy-message: "Deploy ${{ env.DEPLOY_NAME }}@${{ github.sha }}" enable-commit-comment: false alias: ${{ env.DEPLOY_NAME }} env: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..40cd40e2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +ci: + autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks" + autofix_prs: true + autoupdate_branch: dev + autoupdate_schedule: weekly +repos: + - repo: https://github.com/pycqa/isort + rev: 5.10.1 + hooks: + - id: isort + + - repo: https://github.com/psf/black + rev: 21.12b0 + hooks: + - id: black + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.5.1 + hooks: + - id: prettier diff --git a/docs_build/conf.py b/docs_build/conf.py index 76bd31fb..6764ddaf 100644 --- a/docs_build/conf.py +++ b/docs_build/conf.py @@ -17,15 +17,15 @@ sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(__file__)))) # -- Project information ----------------------------------------------------- -project = 'nonebot' -copyright = '2020, richardchien' -author = 'richardchien' +project = "nonebot" +copyright = "2020, richardchien" +author = "richardchien" # The short X.Y version -version = '2.0.0' +version = "2.0.0" # The full version, including alpha/beta/rc tags -release = '2.0.0' +release = "2.0.0" # -- General configuration --------------------------------------------------- @@ -33,48 +33,48 @@ release = '2.0.0' # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.viewcode', - 'sphinx.ext.todo', + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.todo", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'zh_CN' +language = "zh_CN" master_doc = "README" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'alabaster' +html_theme = "alabaster" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # html_baseurl = '/api/' # -- Extension configuration ------------------------------------------------- # -- Options for autodoc extension ---------------------------------------------- -autodoc_default_options = {'member-order': 'bysource'} +autodoc_default_options = {"member-order": "bysource"} autodoc_inherit_docstrings = False -autodoc_typehints = 'none' +autodoc_typehints = "none" # -- Options for todo extension ---------------------------------------------- diff --git a/nonebot/adapters/_adapter.py b/nonebot/adapters/_adapter.py index 85cd0847..1f78e485 100644 --- a/nonebot/adapters/_adapter.py +++ b/nonebot/adapters/_adapter.py @@ -2,7 +2,6 @@ import abc from contextlib import asynccontextmanager from typing import Any, Dict, AsyncGenerator -from ._bot import Bot from nonebot.config import Config from nonebot.drivers import ( Driver, @@ -15,6 +14,8 @@ from nonebot.drivers import ( WebSocketServerSetup, ) +from ._bot import Bot + class Adapter(abc.ABC): def __init__(self, driver: Driver, **kwargs: Any): diff --git a/nonebot/adapters/_event.py b/nonebot/adapters/_event.py index e7780bb2..d81c68cc 100644 --- a/nonebot/adapters/_event.py +++ b/nonebot/adapters/_event.py @@ -2,9 +2,10 @@ import abc from pydantic import BaseModel -from ._message import Message from nonebot.utils import DataclassEncoder +from ._message import Message + class Event(abc.ABC, BaseModel): """Event ćŸșç±»ă€‚æäŸ›èŽ·ć–ć…łé”źäżĄæŻçš„æ–čæł•ïŒŒć…¶äœ™äżĄæŻćŻç›ŽæŽ„èŽ·ć–ă€‚""" diff --git a/nonebot/dependencies/__init__.py b/nonebot/dependencies/__init__.py index 3a52dcdb..49513852 100644 --- a/nonebot/dependencies/__init__.py +++ b/nonebot/dependencies/__init__.py @@ -13,10 +13,11 @@ from pydantic.schema import get_annotation_from_field_info from pydantic.fields import Required, FieldInfo, Undefined, ModelField from nonebot.log import logger -from .utils import get_typed_signature from nonebot.exception import TypeMisMatch from nonebot.utils import run_sync, is_coroutine_callable +from .utils import get_typed_signature + T = TypeVar("T", bound="Dependent") R = TypeVar("R") diff --git a/nonebot/drivers/__init__.py b/nonebot/drivers/__init__.py index a32fdde5..8054955b 100644 --- a/nonebot/drivers/__init__.py +++ b/nonebot/drivers/__init__.py @@ -19,15 +19,16 @@ from typing import ( AsyncGenerator, ) -from ._model import URL as URL from nonebot.log import logger from nonebot.utils import escape_tag -from ._model import Request as Request from nonebot.config import Env, Config +from nonebot.typing import T_BotConnectionHook, T_BotDisconnectionHook + +from ._model import URL as URL +from ._model import Request as Request from ._model import Response as Response from ._model import WebSocket as WebSocket from ._model import HTTPVersion as HTTPVersion -from nonebot.typing import T_BotConnectionHook, T_BotDisconnectionHook if TYPE_CHECKING: from nonebot.adapters import Bot, Adapter diff --git a/nonebot/drivers/fastapi.py b/nonebot/drivers/fastapi.py index 99f374f5..95ab0b76 100644 --- a/nonebot/drivers/fastapi.py +++ b/nonebot/drivers/fastapi.py @@ -16,7 +16,6 @@ from fastapi.responses import Response from fastapi import FastAPI, Request, UploadFile, status from starlette.websockets import WebSocket, WebSocketState, WebSocketDisconnect -from ._model import FileTypes from nonebot.config import Env from nonebot.typing import overrides from nonebot.exception import WebSocketClosed @@ -25,6 +24,8 @@ from nonebot.drivers import Request as BaseRequest from nonebot.drivers import WebSocket as BaseWebSocket from nonebot.drivers import ReverseDriver, HTTPServerSetup, WebSocketServerSetup +from ._model import FileTypes + def catch_closed(func): @wraps(func) diff --git a/nonebot/drivers/quart.py b/nonebot/drivers/quart.py index d6ebbeab..32e00a1d 100644 --- a/nonebot/drivers/quart.py +++ b/nonebot/drivers/quart.py @@ -11,7 +11,6 @@ from typing import List, Tuple, TypeVar, Callable, Optional, Coroutine import uvicorn from pydantic import BaseSettings -from ._model import FileTypes from nonebot.config import Env from nonebot.typing import overrides from nonebot.exception import WebSocketClosed @@ -20,6 +19,8 @@ from nonebot.drivers import Request as BaseRequest from nonebot.drivers import WebSocket as BaseWebSocket from nonebot.drivers import ReverseDriver, HTTPServerSetup, WebSocketServerSetup +from ._model import FileTypes + try: from quart import request as _request from quart import websocket as _websocket diff --git a/nonebot/plugin/manager.py b/nonebot/plugin/manager.py index eb5bef0b..b1c8bb89 100644 --- a/nonebot/plugin/manager.py +++ b/nonebot/plugin/manager.py @@ -10,6 +10,7 @@ from typing import Set, Dict, List, Union, Iterable, Optional, Sequence from nonebot.log import logger from nonebot.utils import escape_tag + from . import _managers, _current_plugin from .plugin import Plugin, _new_plugin, _confirm_plugin diff --git a/nonebot/plugin/on.py b/nonebot/plugin/on.py index d03b1965..eeaa340d 100644 --- a/nonebot/plugin/on.py +++ b/nonebot/plugin/on.py @@ -5,7 +5,6 @@ from types import ModuleType from typing import Any, Set, Dict, List, Type, Tuple, Union, Optional from nonebot.matcher import Matcher -from .manager import _current_plugin from nonebot.permission import Permission from nonebot.dependencies import Dependent from nonebot.typing import ( @@ -25,6 +24,8 @@ from nonebot.rule import ( shell_command, ) +from .manager import _current_plugin + def _store_matcher(matcher: Type[Matcher]) -> None: plugin = _current_plugin.get() diff --git a/nonebot/plugin/plugin.py b/nonebot/plugin/plugin.py index 58098e12..4b8e6254 100644 --- a/nonebot/plugin/plugin.py +++ b/nonebot/plugin/plugin.py @@ -2,9 +2,10 @@ from types import ModuleType from dataclasses import field, dataclass from typing import TYPE_CHECKING, Set, Dict, Type, Optional -from .export import Export from nonebot.matcher import Matcher +from .export import Export + if TYPE_CHECKING: from .manager import PluginManager diff --git a/packages/nonebot-plugin-docs/nonebot_plugin_docs/drivers/fastapi.py b/packages/nonebot-plugin-docs/nonebot_plugin_docs/drivers/fastapi.py index 6afba9cb..e58e4553 100644 --- a/packages/nonebot-plugin-docs/nonebot_plugin_docs/drivers/fastapi.py +++ b/packages/nonebot-plugin-docs/nonebot_plugin_docs/drivers/fastapi.py @@ -1,8 +1,9 @@ from pathlib import Path -from nonebot.drivers.fastapi import Driver from fastapi.staticfiles import StaticFiles +from nonebot.drivers.fastapi import Driver + def register_route(driver: Driver): app = driver.server_app diff --git a/poetry.lock b/poetry.lock index 147ca92c..7f5751bc 100644 --- a/poetry.lock +++ b/poetry.lock @@ -227,6 +227,14 @@ python-versions = "*" [package.dependencies] pycparser = "*" +[[package]] +name = "cfgv" +version = "3.3.1" +description = "Validate configuration and produce human readable error messages." +category = "dev" +optional = false +python-versions = ">=3.6.1" + [[package]] name = "charset-normalizer" version = "2.0.10" @@ -272,6 +280,14 @@ tomli = {version = "*", optional = true, markers = "extra == \"toml\""} [package.extras] toml = ["tomli"] +[[package]] +name = "distlib" +version = "0.3.4" +description = "Distribution utilities" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "docutils" version = "0.17.1" @@ -309,6 +325,18 @@ dev = ["python-jose[cryptography] (>=3.3.0,<4.0.0)", "passlib[bcrypt] (>=1.7.2,< doc = ["mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=7.1.9,<8.0.0)", "mdx-include (>=1.4.1,<2.0.0)", "mkdocs-markdownextradata-plugin (>=0.1.7,<0.3.0)", "typer-cli (>=0.0.12,<0.0.13)", "pyyaml (>=5.3.1,<6.0.0)"] test = ["pytest (>=6.2.4,<7.0.0)", "pytest-cov (>=2.12.0,<4.0.0)", "mypy (==0.910)", "flake8 (>=3.8.3,<4.0.0)", "black (==21.9b0)", "isort (>=5.0.6,<6.0.0)", "requests (>=2.24.0,<3.0.0)", "httpx (>=0.14.0,<0.19.0)", "email_validator (>=1.1.1,<2.0.0)", "sqlalchemy (>=1.3.18,<1.5.0)", "peewee (>=3.13.3,<4.0.0)", "databases[sqlite] (>=0.3.2,<0.6.0)", "orjson (>=3.2.1,<4.0.0)", "ujson (>=4.0.1,<5.0.0)", "python-multipart (>=0.0.5,<0.0.6)", "flask (>=1.1.2,<3.0.0)", "anyio[trio] (>=3.2.1,<4.0.0)", "types-ujson (==0.1.1)", "types-orjson (==3.6.0)", "types-dataclasses (==0.1.7)"] +[[package]] +name = "filelock" +version = "3.4.2" +description = "A platform independent file lock." +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"] +testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"] + [[package]] name = "frozenlist" version = "1.2.0" @@ -431,6 +459,17 @@ category = "main" optional = true python-versions = ">=3.6.1" +[[package]] +name = "identify" +version = "2.4.4" +description = "File identification library for Python" +category = "dev" +optional = false +python-versions = ">=3.6.1" + +[package.extras] +license = ["ukkonen"] + [[package]] name = "idna" version = "3.3" @@ -547,6 +586,14 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "nodeenv" +version = "1.6.0" +description = "Node.js virtual environment builder" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "nonebug" version = "0.2.0" @@ -615,6 +662,23 @@ importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "pre-commit" +version = "2.16.0" +description = "A framework for managing and maintaining multi-language pre-commit hooks." +category = "dev" +optional = false +python-versions = ">=3.6.1" + +[package.dependencies] +cfgv = ">=2.0.0" +identify = ">=1.0.0" +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} +nodeenv = ">=0.11.1" +pyyaml = ">=5.1" +toml = "*" +virtualenv = ">=20.0.8" + [[package]] name = "priority" version = "2.0.0" @@ -870,6 +934,14 @@ idna = {version = "*", optional = true, markers = "extra == \"idna2008\""} [package.extras] idna2008 = ["idna"] +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" + [[package]] name = "sniffio" version = "1.2.0" @@ -1134,6 +1206,25 @@ dev = ["Cython (>=0.29.24,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=4.1.2,<4.2.0 docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)"] test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +[[package]] +name = "virtualenv" +version = "20.13.0" +description = "Virtual Python Environment builder" +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[package.dependencies] +distlib = ">=0.3.1,<1" +filelock = ">=3.2,<4" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +platformdirs = ">=2,<3" +six = ">=1.9.0,<2" + +[package.extras] +docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] +testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)"] + [[package]] name = "watchgod" version = "0.7" @@ -1226,7 +1317,7 @@ websockets = ["websockets"] [metadata] lock-version = "1.1" python-versions = "^3.7.3" -content-hash = "38712544050fe96eb806af6db9adfc4c3db776d30da0f7a07280bdf1a3aa3617" +content-hash = "a7b56ed800a11b847b85c23f507d2bdb6fda127d32b5468d0cc43d2ac79ea659" [metadata.files] aiodns = [ @@ -1493,6 +1584,10 @@ cffi = [ {file = "cffi-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:3773c4d81e6e818df2efbc7dd77325ca0dcb688116050fb2b3011218eda36139"}, {file = "cffi-1.15.0.tar.gz", hash = "sha256:920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954"}, ] +cfgv = [ + {file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"}, + {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, +] charset-normalizer = [ {file = "charset-normalizer-2.0.10.tar.gz", hash = "sha256:876d180e9d7432c5d1dfd4c5d26b72f099d503e8fcc0feb7532c9289be60fcbd"}, {file = "charset_normalizer-2.0.10-py3-none-any.whl", hash = "sha256:cb957888737fc0bbcd78e3df769addb41fd1ff8cf950dc9e7ad7793f1bf44455"}, @@ -1554,6 +1649,10 @@ coverage = [ {file = "coverage-6.2-pp36.pp37.pp38-none-any.whl", hash = "sha256:5829192582c0ec8ca4a2532407bc14c2f338d9878a10442f5d03804a95fac9de"}, {file = "coverage-6.2.tar.gz", hash = "sha256:e2cad8093172b7d1595b4ad66f24270808658e11acf43a8f95b41276162eb5b8"}, ] +distlib = [ + {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, + {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, +] docutils = [ {file = "docutils-0.17.1-py2.py3-none-any.whl", hash = "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"}, {file = "docutils-0.17.1.tar.gz", hash = "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"}, @@ -1566,6 +1665,10 @@ fastapi = [ {file = "fastapi-0.70.1-py3-none-any.whl", hash = "sha256:5367226c7bcd7bfb2e17edaf225fd9a983095b1372281e9a3eb661336fb93748"}, {file = "fastapi-0.70.1.tar.gz", hash = "sha256:21d03979b5336375c66fa5d1f3126c6beca650d5d2166fbb78345a30d33c8d06"}, ] +filelock = [ + {file = "filelock-3.4.2-py3-none-any.whl", hash = "sha256:cf0fc6a2f8d26bd900f19bf33915ca70ba4dd8c56903eeb14e1e7a2fd7590146"}, + {file = "filelock-3.4.2.tar.gz", hash = "sha256:38b4f4c989f9d06d44524df1b24bd19e167d851f19b50bf3e3559952dddc5b80"}, +] frozenlist = [ {file = "frozenlist-1.2.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:977a1438d0e0d96573fd679d291a1542097ea9f4918a8b6494b06610dfeefbf9"}, {file = "frozenlist-1.2.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a8d86547a5e98d9edd47c432f7a14b0c5592624b496ae9880fb6332f34af1edc"}, @@ -1689,6 +1792,10 @@ hyperframe = [ {file = "hyperframe-6.0.1-py3-none-any.whl", hash = "sha256:0ec6bafd80d8ad2195c4f03aacba3a8265e57bc4cff261e802bf39970ed02a15"}, {file = "hyperframe-6.0.1.tar.gz", hash = "sha256:ae510046231dc8e9ecb1a6586f63d2347bf4c8905914aa84ba585ae85f28a914"}, ] +identify = [ + {file = "identify-2.4.4-py2.py3-none-any.whl", hash = "sha256:aa68609c7454dbcaae60a01ff6b8df1de9b39fe6e50b1f6107ec81dcda624aa6"}, + {file = "identify-2.4.4.tar.gz", hash = "sha256:6b4b5031f69c48bf93a646b90de9b381c6b5f560df4cbe0ed3cf7650ae741e4d"}, +] idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, @@ -1870,6 +1977,10 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] +nodeenv = [ + {file = "nodeenv-1.6.0-py2.py3-none-any.whl", hash = "sha256:621e6b7076565ddcacd2db0294c0381e01fd28945ab36bcf00f41c5daf63bef7"}, + {file = "nodeenv-1.6.0.tar.gz", hash = "sha256:3ef13ff90291ba2a4a7a4ff9a979b63ffdd00a464dbe04acf0ea6471517a4c2b"}, +] nonebug = [] packaging = [ {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, @@ -1887,6 +1998,10 @@ pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] +pre-commit = [ + {file = "pre_commit-2.16.0-py2.py3-none-any.whl", hash = "sha256:758d1dc9b62c2ed8881585c254976d66eae0889919ab9b859064fc2fe3c7743e"}, + {file = "pre_commit-2.16.0.tar.gz", hash = "sha256:fe9897cac830aa7164dbd02a4e7b90cae49630451ce88464bca73db486ba9f65"}, +] priority = [ {file = "priority-2.0.0-py3-none-any.whl", hash = "sha256:6f8eefce5f3ad59baf2c080a664037bb4725cd0a790d53d59ab4059288faf6aa"}, {file = "priority-2.0.0.tar.gz", hash = "sha256:c965d54f1b8d0d0b19479db3924c7c36cf672dbf2aec92d43fbdaf4492ba18c0"}, @@ -2059,6 +2174,10 @@ rfc3986 = [ {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, ] +six = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] sniffio = [ {file = "sniffio-1.2.0-py3-none-any.whl", hash = "sha256:471b71698eac1c2112a40ce2752bb2f4a4814c22a54a3eed3676bc0f5ca9f663"}, {file = "sniffio-1.2.0.tar.gz", hash = "sha256:c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de"}, @@ -2169,6 +2288,10 @@ uvloop = [ {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861"}, {file = "uvloop-0.16.0.tar.gz", hash = "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"}, ] +virtualenv = [ + {file = "virtualenv-20.13.0-py2.py3-none-any.whl", hash = "sha256:339f16c4a86b44240ba7223d0f93a7887c3ca04b5f9c8129da7958447d079b09"}, + {file = "virtualenv-20.13.0.tar.gz", hash = "sha256:d8458cf8d59d0ea495ad9b34c2599487f8a7772d796f9910858376d1600dd2dd"}, +] watchgod = [ {file = "watchgod-0.7-py3-none-any.whl", hash = "sha256:d6c1ea21df37847ac0537ca0d6c2f4cdf513562e95f77bb93abbcf05573407b7"}, {file = "watchgod-0.7.tar.gz", hash = "sha256:48140d62b0ebe9dd9cf8381337f06351e1f2e70b2203fa9c6eff4e572ca84f29"}, diff --git a/pyproject.toml b/pyproject.toml index 77501ff3..f7c5c4eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ pytest-cov = "^3.0.0" pytest-xdist = "^2.5.0" nonebug = { git = "https://github.com/nonebot/nonebug.git" } sphinx-markdown-builder = { git = "https://github.com/nonebot/sphinx-markdown-builder.git" } +pre-commit = "^2.16.0" [tool.poetry.extras] quart = ["quart"] @@ -73,7 +74,7 @@ line_length = 80 length_sort = true skip_gitignore = true force_sort_within_sections = true -known_local_folder = ["nonebot"] +src_paths = ["nonebot", "tests"] extra_standard_library = ["typing_extensions"] [build-system] diff --git a/tests/.isort.cfg b/tests/.isort.cfg deleted file mode 100644 index 68396bdd..00000000 --- a/tests/.isort.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[settings] -profile=black -line_length=80 -length_sort=true -skip_gitignore=true -force_sort_within_sections=true -known_local_folder=plugins -extra_standard_library=typing_extensions diff --git a/tests/plugins/require.py b/tests/plugins/require.py index 2b22504f..5764431c 100644 --- a/tests/plugins/require.py +++ b/tests/plugins/require.py @@ -1,6 +1,6 @@ from nonebot import require - from plugins.export import test + from .export import test as test_related test_require = require("export").test diff --git a/tests/test_matcher.py b/tests/test_matcher.py index abaf1a77..def49f42 100644 --- a/tests/test_matcher.py +++ b/tests/test_matcher.py @@ -103,7 +103,6 @@ async def test_type_updater(app: App, load_plugin): @pytest.mark.asyncio async def test_permission_updater(app: App, load_plugin): from nonebot.permission import User - from plugins.matcher.matcher_permission import ( default_permission, test_custom_updater, diff --git a/tests/test_param.py b/tests/test_param.py index 576d0cbc..e5157635 100644 --- a/tests/test_param.py +++ b/tests/test_param.py @@ -7,7 +7,6 @@ from utils import make_fake_event, make_fake_message @pytest.mark.asyncio async def test_depend(app: App, load_plugin): from nonebot.params import DependParam - from plugins.param.param_depend import ( ClassDependency, runned, @@ -37,7 +36,6 @@ async def test_depend(app: App, load_plugin): @pytest.mark.asyncio async def test_bot(app: App, load_plugin): from nonebot.params import BotParam - from plugins.param.param_bot import get_bot async with app.test_dependent(get_bot, allow_types=[BotParam]) as ctx: @@ -49,7 +47,6 @@ async def test_bot(app: App, load_plugin): @pytest.mark.asyncio async def test_event(app: App, load_plugin): from nonebot.params import EventParam, DependParam - from plugins.param.param_event import ( event, event_type, @@ -104,7 +101,6 @@ async def test_state(app: App, load_plugin): REGEX_GROUP, REGEX_MATCHED, ) - from plugins.param.param_state import ( state, command, @@ -184,7 +180,6 @@ async def test_state(app: App, load_plugin): async def test_matcher(app: App, load_plugin): from nonebot.matcher import Matcher from nonebot.params import DependParam, MatcherParam - from plugins.param.param_matcher import matcher, receive, last_receive fake_matcher = Matcher() @@ -215,7 +210,6 @@ async def test_matcher(app: App, load_plugin): async def test_arg(app: App, load_plugin): from nonebot.matcher import Matcher from nonebot.params import ArgParam - from plugins.param.param_arg import arg, arg_str, arg_plain_text matcher = Matcher() @@ -238,7 +232,6 @@ async def test_arg(app: App, load_plugin): @pytest.mark.asyncio async def test_exception(app: App, load_plugin): from nonebot.params import ExceptionParam - from plugins.param.param_exception import exc exception = ValueError("test") @@ -250,7 +243,6 @@ async def test_exception(app: App, load_plugin): @pytest.mark.asyncio async def test_default(app: App, load_plugin): from nonebot.params import DefaultParam - from plugins.param.param_default import default async with app.test_dependent(default, allow_types=[DefaultParam]) as ctx: diff --git a/website/babel.config.js b/website/babel.config.js index e00595da..bfd75dbd 100644 --- a/website/babel.config.js +++ b/website/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], + presets: [require.resolve("@docusaurus/core/lib/babel/preset")], }; diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 2d09fea6..05897b4b 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -22,7 +22,7 @@ const config = { "zh-Hans": { label: "çź€äœ“äž­æ–‡" }, }, }, - + scripts: ["/unregister-sw.js"], presets: [ diff --git a/website/src/components/Paginate/styles.module.css b/website/src/components/Paginate/styles.module.css index 0abb409a..bbd2e58b 100644 --- a/website/src/components/Paginate/styles.module.css +++ b/website/src/components/Paginate/styles.module.css @@ -24,7 +24,6 @@ @apply bg-hero text-white border-hero; } - .disabled { @apply opacity-60 pointer-events-none; } diff --git a/website/static/plugins.json b/website/static/plugins.json index 2e454dc9..774305a1 100644 --- a/website/static/plugins.json +++ b/website/static/plugins.json @@ -838,4 +838,4 @@ "tags": [], "is_official": false } -] \ No newline at end of file +] diff --git a/website/static/unregister-sw.js b/website/static/unregister-sw.js index 50cdbb9c..8216d0b1 100644 --- a/website/static/unregister-sw.js +++ b/website/static/unregister-sw.js @@ -1 +1,16 @@ -navigator.serviceWorker.getRegistrations().then(function(e){for(var r,i=e,t=Array.isArray(i),a=0,i=t?i:i[Symbol.iterator]();;){if(t){if(a>=i.length)break;r=i[a++]}else{if((a=i.next()).done)break;r=a.value}r.unregister()}}); \ No newline at end of file +navigator.serviceWorker.getRegistrations().then(function (e) { + for ( + var r, i = e, t = Array.isArray(i), a = 0, i = t ? i : i[Symbol.iterator](); + ; + + ) { + if (t) { + if (a >= i.length) break; + r = i[a++]; + } else { + if ((a = i.next()).done) break; + r = a.value; + } + r.unregister(); + } +}); diff --git a/website/versions.json b/website/versions.json index 782db369..c543a3e3 100644 --- a/website/versions.json +++ b/website/versions.json @@ -1,3 +1 @@ -[ - "2.0.0-beta.1" -] +["2.0.0-beta.1"]