mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
🔥 remove useless noreturn
This commit is contained in:
@ -13,7 +13,7 @@ from pydantic import BaseModel
|
||||
|
||||
from nonebot.config import Config
|
||||
from nonebot.typing import Driver, Message, WebSocket
|
||||
from nonebot.typing import Any, Dict, Union, Optional, NoReturn, Callable, Iterable, Awaitable, TypeVar, Generic
|
||||
from nonebot.typing import Any, Dict, Union, Optional, Callable, Iterable, Awaitable, TypeVar, Generic
|
||||
|
||||
|
||||
class BaseBot(abc.ABC):
|
||||
@ -61,8 +61,7 @@ class BaseBot(abc.ABC):
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
async def check_permission(cls, driver: Driver, connection_type: str,
|
||||
headers: dict,
|
||||
body: Optional[dict]) -> Union[str, NoReturn]:
|
||||
headers: dict, body: Optional[dict]) -> str:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
|
@ -12,7 +12,7 @@ from nonebot.adapters import BaseBot
|
||||
from nonebot.message import handle_event
|
||||
from nonebot.exception import RequestDenied
|
||||
from nonebot.typing import Any, Dict, Union, Optional
|
||||
from nonebot.typing import overrides, Driver, WebSocket, NoReturn
|
||||
from nonebot.typing import overrides, Driver, WebSocket
|
||||
|
||||
from .event import Event
|
||||
from .message import Message, MessageSegment
|
||||
@ -20,8 +20,7 @@ from .exception import NetworkError, ApiNotAvailable, ActionFailed
|
||||
from .utils import log
|
||||
|
||||
|
||||
def get_auth_bearer(
|
||||
access_token: Optional[str] = None) -> Union[Optional[str], NoReturn]:
|
||||
def get_auth_bearer(access_token: Optional[str] = None) -> Optional[str]:
|
||||
if not access_token:
|
||||
return None
|
||||
scheme, _, param = access_token.partition(" ")
|
||||
@ -153,8 +152,7 @@ def _check_nickname(bot: "Bot", event: "Event"):
|
||||
first_msg_seg.data["text"] = first_text[m.end():]
|
||||
|
||||
|
||||
def _handle_api_result(
|
||||
result: Optional[Dict[str, Any]]) -> Union[Any, NoReturn]:
|
||||
def _handle_api_result(result: Optional[Dict[str, Any]]) -> Any:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
@ -238,8 +236,7 @@ class Bot(BaseBot):
|
||||
@classmethod
|
||||
@overrides(BaseBot)
|
||||
async def check_permission(cls, driver: Driver, connection_type: str,
|
||||
headers: dict,
|
||||
body: Optional[dict]) -> Union[str, NoReturn]:
|
||||
headers: dict, body: Optional[dict]) -> str:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
@ -310,7 +307,7 @@ class Bot(BaseBot):
|
||||
)
|
||||
|
||||
@overrides(BaseBot)
|
||||
async def call_api(self, api: str, **data) -> Union[Any, NoReturn]:
|
||||
async def call_api(self, api: str, **data) -> Any:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
@ -382,7 +379,7 @@ class Bot(BaseBot):
|
||||
event: Event,
|
||||
message: Union[str, Message, MessageSegment],
|
||||
at_sender: bool = False,
|
||||
**kwargs) -> Union[Any, NoReturn]:
|
||||
**kwargs) -> Any:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
|
@ -2,14 +2,13 @@ import asyncio
|
||||
|
||||
from nonebot.config import Config
|
||||
from nonebot.adapters import BaseBot
|
||||
from nonebot.typing import Any, Dict, List, Union, Driver, Optional, NoReturn, WebSocket
|
||||
from nonebot.typing import Any, Dict, List, Union, Driver, Optional, WebSocket
|
||||
|
||||
from .event import Event
|
||||
from .message import Message, MessageSegment
|
||||
|
||||
|
||||
def get_auth_bearer(
|
||||
access_token: Optional[str] = ...) -> Union[Optional[str], NoReturn]:
|
||||
def get_auth_bearer(access_token: Optional[str] = ...) -> Optional[str]:
|
||||
...
|
||||
|
||||
|
||||
@ -25,8 +24,7 @@ def _check_nickname(bot: "Bot", event: Event):
|
||||
...
|
||||
|
||||
|
||||
def _handle_api_result(
|
||||
result: Optional[Dict[str, Any]]) -> Union[Any, NoReturn]:
|
||||
def _handle_api_result(result: Optional[Dict[str, Any]]) -> Any:
|
||||
...
|
||||
|
||||
|
||||
@ -63,19 +61,18 @@ class Bot(BaseBot):
|
||||
|
||||
@classmethod
|
||||
async def check_permission(cls, driver: Driver, connection_type: str,
|
||||
headers: dict,
|
||||
body: Optional[dict]) -> Union[str, NoReturn]:
|
||||
headers: dict, body: Optional[dict]) -> str:
|
||||
...
|
||||
|
||||
async def handle_message(self, message: dict):
|
||||
...
|
||||
|
||||
async def call_api(self, api: str, **data) -> Union[Any, NoReturn]:
|
||||
async def call_api(self, api: str, **data) -> Any:
|
||||
...
|
||||
|
||||
async def send(self, event: Event, message: Union[str, Message,
|
||||
MessageSegment],
|
||||
**kwargs) -> Union[Any, NoReturn]:
|
||||
**kwargs) -> Any:
|
||||
...
|
||||
|
||||
async def send_private_msg(self,
|
||||
|
@ -8,7 +8,7 @@ from nonebot.config import Config
|
||||
from nonebot.adapters import BaseBot
|
||||
from nonebot.message import handle_event
|
||||
from nonebot.exception import RequestDenied
|
||||
from nonebot.typing import Any, Union, Driver, Optional, NoReturn
|
||||
from nonebot.typing import Any, Union, Driver, Optional
|
||||
|
||||
from .utils import log
|
||||
from .event import Event
|
||||
@ -86,7 +86,7 @@ class Bot(BaseBot):
|
||||
async def call_api(self,
|
||||
api: str,
|
||||
event: Optional[Event] = None,
|
||||
**data) -> Union[Any, NoReturn]:
|
||||
**data) -> Any:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
@ -159,7 +159,7 @@ class Bot(BaseBot):
|
||||
event: Event,
|
||||
message: Union[str, "Message", "MessageSegment"],
|
||||
at_sender: bool = False,
|
||||
**kwargs) -> Union[Any, NoReturn]:
|
||||
**kwargs) -> Any:
|
||||
"""
|
||||
:说明:
|
||||
|
||||
|
Reference in New Issue
Block a user