add pycln to auto remove unused imports (#1481)

This commit is contained in:
Ju4tCode 2022-12-17 17:04:38 +08:00 committed by GitHub
parent 932f50d1fb
commit a5d26b7747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1539 additions and 1417 deletions

View File

@ -6,14 +6,20 @@ ci:
autoupdate_schedule: monthly autoupdate_schedule: monthly
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
repos: repos:
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.2
hooks:
- id: pycln
args: [--config, pyproject.toml]
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.10.1 rev: v5.11.3
hooks: hooks:
- id: isort - id: isort
stages: [commit] stages: [commit]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.10.0 rev: 22.12.0
hooks: hooks:
- id: black - id: black
stages: [commit] stages: [commit]

View File

@ -9,7 +9,6 @@ FrontMatter:
description: nonebot.config 模块 description: nonebot.config 模块
""" """
import os import os
from pathlib import Path
from datetime import timedelta from datetime import timedelta
from ipaddress import IPv4Address from ipaddress import IPv4Address
from typing import TYPE_CHECKING, Any, Set, Dict, Tuple, Union, Mapping, Optional from typing import TYPE_CHECKING, Any, Set, Dict, Tuple, Union, Mapping, Optional

View File

@ -12,7 +12,8 @@ from pydantic import BaseModel
from nonebot.matcher import Matcher from nonebot.matcher import Matcher
from . import _plugins as plugins # FIXME: backport for nonebug # FIXME: backport for nonebug
from . import _plugins as plugins # nopycln: import
if TYPE_CHECKING: if TYPE_CHECKING:
from .manager import PluginManager from .manager import PluginManager

2935
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,7 @@ aiohttp = { version = "^3.7.4", extras = ["speedups"], optional = true }
httpx = { version = ">=0.20.0,<1.0.0", extras = ["http2"], optional = true } httpx = { version = ">=0.20.0,<1.0.0", extras = ["http2"], optional = true }
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pycln = "^2.1.2"
isort = "^5.10.1" isort = "^5.10.1"
black = "^22.1.0" black = "^22.1.0"
nonemoji = "^0.1.2" nonemoji = "^0.1.2"
@ -83,6 +84,10 @@ force_sort_within_sections = true
src_paths = ["nonebot", "tests"] src_paths = ["nonebot", "tests"]
extra_standard_library = ["typing_extensions"] extra_standard_library = ["typing_extensions"]
[tool.pycln]
path = "."
all = false
[build-system] [build-system]
requires = ["poetry_core>=1.0.0"] requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api" build-backend = "poetry.core.masonry.api"

View File

@ -1 +1 @@
from .nested_subplugin2 import a from .nested_subplugin2 import a # nopycln: import