mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
change typing manage
This commit is contained in:
parent
950dbb1115
commit
f2b6f08599
@ -3,10 +3,10 @@
|
||||
|
||||
import logging
|
||||
import importlib
|
||||
from typing import Optional
|
||||
from ipaddress import IPv4Address
|
||||
|
||||
from nonebot.log import logger
|
||||
from nonebot.typing import Optional
|
||||
from nonebot.config import Env, Config
|
||||
from nonebot.drivers import BaseDriver
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
import abc
|
||||
from functools import reduce
|
||||
from typing import Dict, Union, Iterable, Optional
|
||||
|
||||
from nonebot.config import Config
|
||||
from nonebot.typing import Dict, Union, Iterable, Optional
|
||||
|
||||
|
||||
class BaseBot(abc.ABC):
|
||||
|
@ -2,7 +2,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from typing import Tuple, Iterable, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
@ -11,6 +10,7 @@ from nonebot.config import Config
|
||||
from nonebot.message import handle_event
|
||||
from nonebot.drivers import BaseWebSocket
|
||||
from nonebot.exception import ApiNotAvailable
|
||||
from nonebot.typing import Tuple, Iterable, Optional
|
||||
from nonebot.adapters import BaseBot, BaseMessage, BaseMessageSegment
|
||||
|
||||
|
||||
|
@ -5,11 +5,12 @@ import os
|
||||
from pathlib import Path
|
||||
from datetime import timedelta
|
||||
from ipaddress import IPv4Address
|
||||
from typing import Set, Dict, Union, Mapping, Optional
|
||||
|
||||
from pydantic import BaseSettings
|
||||
from pydantic.env_settings import SettingsError, env_file_sentinel, read_env_file
|
||||
|
||||
from nonebot.typing import Set, Dict, Union, Mapping, Optional
|
||||
|
||||
|
||||
class BaseConfig(BaseSettings):
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import abc
|
||||
from typing import Optional
|
||||
from ipaddress import IPv4Address
|
||||
|
||||
from nonebot.config import Config
|
||||
from nonebot.typing import Optional
|
||||
|
||||
|
||||
class BaseDriver(abc.ABC):
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Dict, Optional
|
||||
from ipaddress import IPv4Address
|
||||
|
||||
import uvicorn
|
||||
@ -14,6 +13,7 @@ from fastapi import Body, status, Header, FastAPI, WebSocket as FastAPIWebSocket
|
||||
from nonebot.log import logger
|
||||
from nonebot.config import Config
|
||||
from nonebot.adapters import BaseBot
|
||||
from nonebot.typing import Dict, Optional
|
||||
from nonebot.adapters.cqhttp import Bot as CQBot
|
||||
from nonebot.drivers import BaseDriver, BaseWebSocket
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from nonebot.typing import Any, Dict, Optional
|
||||
|
||||
|
||||
class Event(dict):
|
||||
|
@ -4,11 +4,11 @@
|
||||
from functools import wraps
|
||||
from datetime import datetime
|
||||
from collections import defaultdict
|
||||
from typing import Type, List, Dict, Optional, Callable
|
||||
|
||||
from nonebot.event import Event
|
||||
from nonebot.typing import Handler
|
||||
from nonebot.rule import Rule, user
|
||||
from nonebot.typing import Type, List, Dict, Optional, Callable
|
||||
from nonebot.exception import PausedException, RejectedException, FinishedException
|
||||
|
||||
matchers: Dict[int, List[Type["Matcher"]]] = defaultdict(list)
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
import asyncio
|
||||
from datetime import datetime
|
||||
from typing import Set, Callable
|
||||
|
||||
from nonebot.log import logger
|
||||
from nonebot.event import Event
|
||||
from nonebot.matcher import matchers
|
||||
from nonebot.typing import Set, Callable
|
||||
from nonebot.exception import IgnoredException
|
||||
|
||||
_event_preprocessors: Set[Callable] = set()
|
||||
|
@ -4,11 +4,10 @@
|
||||
import os
|
||||
import re
|
||||
import importlib
|
||||
from types import ModuleType
|
||||
from typing import Set, Dict, Type, Optional
|
||||
|
||||
from nonebot.log import logger
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.typing import Set, Dict, Type, Optional, ModuleType
|
||||
from nonebot.rule import Rule, metaevent, message, notice, request
|
||||
|
||||
plugins: Dict[str, "Plugin"] = {}
|
||||
|
@ -2,9 +2,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from typing import Union, Callable, Optional
|
||||
|
||||
from nonebot.event import Event
|
||||
from nonebot.typing import Union, Callable, Optional
|
||||
|
||||
|
||||
class Rule:
|
||||
|
@ -1,6 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Callable, Awaitable
|
||||
from types import ModuleType
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Any, Set, List, Dict, Type, Tuple, Mapping
|
||||
from typing import Union, Optional, Iterable, Callable, Awaitable
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from nonebot.adapters import BaseBot as Bot
|
||||
from nonebot.event import Event
|
||||
|
||||
Handler = Callable[["Bot", "Event", dict], Awaitable[None]]
|
||||
|
Loading…
Reference in New Issue
Block a user