mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-21 18:15:50 +08:00
⬆️ auto update by pre-commit hooks (#3301)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
4d9f5f0953
commit
af5dfcee72
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -103,8 +103,7 @@ class Driver(BaseDriver):
|
||||
"</bg #f8bbd0></r>"
|
||||
)
|
||||
logger.error(
|
||||
"<r><bg #f8bbd0>Application startup failed. "
|
||||
"Exiting.</bg #f8bbd0></r>"
|
||||
"<r><bg #f8bbd0>Application startup failed. Exiting.</bg #f8bbd0></r>"
|
||||
)
|
||||
|
||||
with catch({Exception: handle_exception}):
|
||||
@ -136,8 +135,7 @@ class Driver(BaseDriver):
|
||||
"</bg #f8bbd0></r>"
|
||||
)
|
||||
logger.error(
|
||||
"<r><bg #f8bbd0>Application shutdown failed. "
|
||||
"Exiting.</bg #f8bbd0></r>"
|
||||
"<r><bg #f8bbd0>Application shutdown failed. Exiting.</bg #f8bbd0></r>"
|
||||
)
|
||||
|
||||
with catch({Exception: handle_exception}):
|
||||
|
@ -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:
|
||||
|
@ -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"<b><u>http://{host}:{port}/website/</u></b>"
|
||||
f"Nonebot docs will be running at: <b><u>http://{host}:{port}/website/</u></b>"
|
||||
)
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user