diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5284107b..d1f45dbf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.4 hooks: - id: ruff args: [--fix] diff --git a/nonebot/__init__.py b/nonebot/__init__.py index 2e8575c0..1a600350 100644 --- a/nonebot/__init__.py +++ b/nonebot/__init__.py @@ -190,9 +190,9 @@ def get_asgi() -> Any: ``` """ driver = get_driver() - assert isinstance( - driver, ASGIMixin - ), "asgi object is only available for asgi driver" + assert isinstance(driver, ASGIMixin), ( + "asgi object is only available for asgi driver" + ) return driver.asgi diff --git a/nonebot/drivers/none.py b/nonebot/drivers/none.py index 802eb760..9188d904 100644 --- a/nonebot/drivers/none.py +++ b/nonebot/drivers/none.py @@ -103,8 +103,7 @@ class Driver(BaseDriver): "" ) logger.error( - "Application startup failed. " - "Exiting." + "Application startup failed. Exiting." ) with catch({Exception: handle_exception}): @@ -136,8 +135,7 @@ class Driver(BaseDriver): "" ) logger.error( - "Application shutdown failed. " - "Exiting." + "Application shutdown failed. Exiting." ) with catch({Exception: handle_exception}): diff --git a/nonebot/internal/params.py b/nonebot/internal/params.py index 86f776d6..e58b782b 100644 --- a/nonebot/internal/params.py +++ b/nonebot/internal/params.py @@ -228,9 +228,9 @@ class DependParam(Param): dependency: T_Handler # sub dependency is not specified, use type annotation if depends_inner.dependency is None: - assert ( - type_annotation is not inspect.Signature.empty - ), "Dependency cannot be empty" + assert type_annotation is not inspect.Signature.empty, ( + "Dependency cannot be empty" + ) dependency = type_annotation else: dependency = depends_inner.dependency @@ -291,9 +291,9 @@ class DependParam(Param): return await dependency_cache[call].wait() if is_gen_callable(call) or is_async_gen_callable(call): - assert isinstance( - stack, AsyncExitStack - ), "Generator dependency should be called in context" + assert isinstance(stack, AsyncExitStack), ( + "Generator dependency should be called in context" + ) if is_gen_callable(call): cm = run_sync_ctx_manager(contextmanager(call)(**sub_values)) else: diff --git a/packages/nonebot-plugin-docs/nonebot_plugin_docs/__init__.py b/packages/nonebot-plugin-docs/nonebot_plugin_docs/__init__.py index 196fdeb0..4879938c 100644 --- a/packages/nonebot-plugin-docs/nonebot_plugin_docs/__init__.py +++ b/packages/nonebot-plugin-docs/nonebot_plugin_docs/__init__.py @@ -31,8 +31,7 @@ def init(): if host in {"0.0.0.0", "127.0.0.1"}: host = "localhost" logger.opt(colors=True).info( - f"Nonebot docs will be running at: " - f"http://{host}:{port}/website/" + f"Nonebot docs will be running at: http://{host}:{port}/website/" ) diff --git a/tests/test_driver.py b/tests/test_driver.py index 3a276414..0fced0b7 100644 --- a/tests/test_driver.py +++ b/tests/test_driver.py @@ -251,9 +251,9 @@ async def test_http_client(driver: Driver, server_url: URL): cookies={"session": "test"}, content="test", ) - assert ( - request.url == request_raw_url.url - ), "request.url should be equal to request_raw_url.url" + assert request.url == request_raw_url.url, ( + "request.url should be equal to request_raw_url.url" + ) assert response.status_code == 200 assert response.content data = json.loads(response.content)