mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 20:16:47 +00: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:
committed by
GitHub
parent
4d9f5f0953
commit
af5dfcee72
@ -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:
|
||||
|
Reference in New Issue
Block a user