mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-23 02:55:35 +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"
|
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks"
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.8.6
|
rev: v0.9.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix]
|
args: [--fix]
|
||||||
|
@ -190,9 +190,9 @@ def get_asgi() -> Any:
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
driver = get_driver()
|
driver = get_driver()
|
||||||
assert isinstance(
|
assert isinstance(driver, ASGIMixin), (
|
||||||
driver, ASGIMixin
|
"asgi object is only available for asgi driver"
|
||||||
), "asgi object is only available for asgi driver"
|
)
|
||||||
return driver.asgi
|
return driver.asgi
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,8 +103,7 @@ class Driver(BaseDriver):
|
|||||||
"</bg #f8bbd0></r>"
|
"</bg #f8bbd0></r>"
|
||||||
)
|
)
|
||||||
logger.error(
|
logger.error(
|
||||||
"<r><bg #f8bbd0>Application startup failed. "
|
"<r><bg #f8bbd0>Application startup failed. Exiting.</bg #f8bbd0></r>"
|
||||||
"Exiting.</bg #f8bbd0></r>"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
with catch({Exception: handle_exception}):
|
with catch({Exception: handle_exception}):
|
||||||
@ -136,8 +135,7 @@ class Driver(BaseDriver):
|
|||||||
"</bg #f8bbd0></r>"
|
"</bg #f8bbd0></r>"
|
||||||
)
|
)
|
||||||
logger.error(
|
logger.error(
|
||||||
"<r><bg #f8bbd0>Application shutdown failed. "
|
"<r><bg #f8bbd0>Application shutdown failed. Exiting.</bg #f8bbd0></r>"
|
||||||
"Exiting.</bg #f8bbd0></r>"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
with catch({Exception: handle_exception}):
|
with catch({Exception: handle_exception}):
|
||||||
|
@ -228,9 +228,9 @@ class DependParam(Param):
|
|||||||
dependency: T_Handler
|
dependency: T_Handler
|
||||||
# sub dependency is not specified, use type annotation
|
# sub dependency is not specified, use type annotation
|
||||||
if depends_inner.dependency is None:
|
if depends_inner.dependency is None:
|
||||||
assert (
|
assert type_annotation is not inspect.Signature.empty, (
|
||||||
type_annotation is not inspect.Signature.empty
|
"Dependency cannot be empty"
|
||||||
), "Dependency cannot be empty"
|
)
|
||||||
dependency = type_annotation
|
dependency = type_annotation
|
||||||
else:
|
else:
|
||||||
dependency = depends_inner.dependency
|
dependency = depends_inner.dependency
|
||||||
@ -291,9 +291,9 @@ class DependParam(Param):
|
|||||||
return await dependency_cache[call].wait()
|
return await dependency_cache[call].wait()
|
||||||
|
|
||||||
if is_gen_callable(call) or is_async_gen_callable(call):
|
if is_gen_callable(call) or is_async_gen_callable(call):
|
||||||
assert isinstance(
|
assert isinstance(stack, AsyncExitStack), (
|
||||||
stack, AsyncExitStack
|
"Generator dependency should be called in context"
|
||||||
), "Generator dependency should be called in context"
|
)
|
||||||
if is_gen_callable(call):
|
if is_gen_callable(call):
|
||||||
cm = run_sync_ctx_manager(contextmanager(call)(**sub_values))
|
cm = run_sync_ctx_manager(contextmanager(call)(**sub_values))
|
||||||
else:
|
else:
|
||||||
|
@ -31,8 +31,7 @@ def init():
|
|||||||
if host in {"0.0.0.0", "127.0.0.1"}:
|
if host in {"0.0.0.0", "127.0.0.1"}:
|
||||||
host = "localhost"
|
host = "localhost"
|
||||||
logger.opt(colors=True).info(
|
logger.opt(colors=True).info(
|
||||||
f"Nonebot docs will be running at: "
|
f"Nonebot docs will be running at: <b><u>http://{host}:{port}/website/</u></b>"
|
||||||
f"<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"},
|
cookies={"session": "test"},
|
||||||
content="test",
|
content="test",
|
||||||
)
|
)
|
||||||
assert (
|
assert request.url == request_raw_url.url, (
|
||||||
request.url == request_raw_url.url
|
"request.url should be equal to request_raw_url.url"
|
||||||
), "request.url should be equal to request_raw_url.url"
|
)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.content
|
assert response.content
|
||||||
data = json.loads(response.content)
|
data = json.loads(response.content)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user