mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +08:00
🧑💻 Develop: 添加 Pyright 检查 (#2194)
This commit is contained in:
parent
6ebeefed79
commit
cb9fcae64c
26
.github/workflows/pyright.yml
vendored
Normal file
26
.github/workflows/pyright.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: Pyright Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
paths:
|
||||
- "nonebot/**"
|
||||
- "packages/**"
|
||||
- "tests/**"
|
||||
|
||||
jobs:
|
||||
pyright:
|
||||
name: Pyright Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python environment
|
||||
uses: ./.github/actions/setup-python
|
||||
|
||||
- run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Run Pyright
|
||||
uses: jakebailey/pyright-action@v1
|
20
README.md
20
README.md
@ -19,9 +19,19 @@ _✨ 跨平台 Python 异步机器人框架 ✨_
|
||||
<img src="https://img.shields.io/github/license/nonebot/nonebot2" alt="license">
|
||||
</a>
|
||||
<a href="https://pypi.python.org/pypi/nonebot2">
|
||||
<img src="https://img.shields.io/pypi/v/nonebot2" alt="pypi">
|
||||
<img src="https://img.shields.io/pypi/v/nonebot2?logo=python&logoColor=edb641" alt="pypi">
|
||||
</a>
|
||||
<img src="https://img.shields.io/badge/python-3.8+-blue" alt="python">
|
||||
<img src="https://img.shields.io/badge/python-3.8+-blue?logo=python&logoColor=edb641" alt="python">
|
||||
<a href="https://github.com/psf/black">
|
||||
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?logo=python&logoColor=edb641" alt="black">
|
||||
</a>
|
||||
<a href="https://github.com/Microsoft/pyright">
|
||||
<img src="https://img.shields.io/badge/types-pyright-797952.svg?logo=python&logoColor=edb641" alt="pyright">
|
||||
</a>
|
||||
<a href="https://github.com/astral-sh/ruff">
|
||||
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json" alt="ruff">
|
||||
</a>
|
||||
<br />
|
||||
<a href="https://codecov.io/gh/nonebot/nonebot2">
|
||||
<img src="https://codecov.io/gh/nonebot/nonebot2/branch/master/graph/badge.svg?token=2P0G0VS7N4" alt="codecov"/>
|
||||
</a>
|
||||
@ -31,6 +41,12 @@ _✨ 跨平台 Python 异步机器人框架 ✨_
|
||||
<a href="https://results.pre-commit.ci/latest/github/nonebot/nonebot2/master">
|
||||
<img src="https://results.pre-commit.ci/badge/github/nonebot/nonebot2/master.svg" alt="pre-commit" />
|
||||
</a>
|
||||
<a href="https://github.com/nonebot/nonebot2/actions/workflows/pyright.yml">
|
||||
<img src="https://github.com/nonebot/nonebot2/actions/workflows/pyright.yml/badge.svg?branch=master&event=push" alt="pyright">
|
||||
</a>
|
||||
<a href="https://github.com/nonebot/nonebot2/actions/workflows/ruff.yml">
|
||||
<img src="https://github.com/nonebot/nonebot2/actions/workflows/ruff.yml/badge.svg?branch=master&event=push" alt="ruff">
|
||||
</a>
|
||||
<br />
|
||||
<a href="https://onebot.dev/">
|
||||
<img src="https://img.shields.io/badge/OneBot-v11-black?style=social&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAIVBMVEUAAAAAAAADAwMHBwceHh4UFBQNDQ0ZGRkoKCgvLy8iIiLWSdWYAAAAAXRSTlMAQObYZgAAAQVJREFUSMftlM0RgjAQhV+0ATYK6i1Xb+iMd0qgBEqgBEuwBOxU2QDKsjvojQPvkJ/ZL5sXkgWrFirK4MibYUdE3OR2nEpuKz1/q8CdNxNQgthZCXYVLjyoDQftaKuniHHWRnPh2GCUetR2/9HsMAXyUT4/3UHwtQT2AggSCGKeSAsFnxBIOuAggdh3AKTL7pDuCyABcMb0aQP7aM4AnAbc/wHwA5D2wDHTTe56gIIOUA/4YYV2e1sg713PXdZJAuncdZMAGkAukU9OAn40O849+0ornPwT93rphWF0mgAbauUrEOthlX8Zu7P5A6kZyKCJy75hhw1Mgr9RAUvX7A3csGqZegEdniCx30c3agAAAABJRU5ErkJggg==" alt="onebot">
|
||||
|
@ -1,4 +1,5 @@
|
||||
import re
|
||||
from typing import Any
|
||||
from types import ModuleType
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
@ -177,10 +178,10 @@ def on_type(
|
||||
|
||||
class _Group:
|
||||
matchers: list[type[Matcher]] = ...
|
||||
base_kwargs: dict[str, ...] = ...
|
||||
base_kwargs: dict[str, Any] = ...
|
||||
def _get_final_kwargs(
|
||||
self, update: dict[str, ...], *, exclude: set[str, ...] | None = None
|
||||
) -> dict[str, ...]: ...
|
||||
self, update: dict[str, Any], *, exclude: set[str] | None = None
|
||||
) -> dict[str, Any]: ...
|
||||
|
||||
class CommandGroup(_Group):
|
||||
basecmd: tuple[str, ...] = ...
|
||||
|
@ -11,10 +11,12 @@
|
||||
"start": "yarn workspace nonebot start",
|
||||
"serve": "yarn workspace nonebot serve",
|
||||
"clear": "yarn workspace nonebot clear",
|
||||
"prettier": "prettier --config ./.prettierrc --write \"./website/\""
|
||||
"prettier": "prettier --config ./.prettierrc --write \"./website/\"",
|
||||
"pyright": "pyright"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"prettier": "^2.5.0"
|
||||
"prettier": "^2.5.0",
|
||||
"pyright": "^1.1.317"
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,6 @@ fixture-parentheses = false
|
||||
mark-parentheses = false
|
||||
|
||||
[tool.pyright]
|
||||
reportShadowedImports = false
|
||||
pythonVersion = "3.8"
|
||||
pythonPlatform = "All"
|
||||
executionEnvironments = [
|
||||
@ -112,6 +111,9 @@ executionEnvironments = [
|
||||
{ root = "./" },
|
||||
]
|
||||
|
||||
typeCheckingMode = "basic"
|
||||
reportShadowedImports = false
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry_core>=1.0.0"]
|
||||
|
@ -6219,6 +6219,11 @@ pupa@^2.1.1:
|
||||
dependencies:
|
||||
escape-goat "^2.0.0"
|
||||
|
||||
pyright@^1.1.317:
|
||||
version "1.1.317"
|
||||
resolved "https://registry.npmjs.org/pyright/-/pyright-1.1.317.tgz#753ac481e2b9c9e2a7b9faf6e2a49a1dc1c73806"
|
||||
integrity sha512-3tGq//Nmqfp8IDuFfQwF18dqDBq5SRo/OPBJLiW0p+VwDVSth1LS1fBrMy/u14Mqcdi7C+ARVnxXTBCpczZahg==
|
||||
|
||||
q@^1.1.2:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
|
||||
|
Loading…
Reference in New Issue
Block a user