Skip to content

Commit

Permalink
fix: 修复在 Python 3.8 和 3.9 下的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
st1020 committed Sep 6, 2023
1 parent bdefccc commit 6bdcedd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions alicebot/bot.py
Expand Up @@ -79,13 +79,13 @@ class Bot:
"""

config: MainConfig
should_exit: asyncio.Event
should_exit: asyncio.Event # pyright: ignore[reportUninitializedInstanceVariable]
adapters: List[Adapter[Any, Any]]
plugins_priority_dict: Dict[int, List[Type[Plugin[Any, Any, Any]]]]
plugin_state: Dict[str, Any]
global_state: Dict[Any, Any]

_condition: asyncio.Condition # 用于处理 get 的 Condition
_condition: asyncio.Condition # 用于处理 get 的 Condition # pyright: ignore[reportUninitializedInstanceVariable]
_current_event: Optional[Event[Any]] # 当前待处理的 Event

_restart_flag: bool # 重新启动标志
Expand Down Expand Up @@ -132,13 +132,11 @@ def __init__(
启用后将自动检查 `plugin_dir` 中的插件文件更新,并在更新时自动重新加载。
"""
self.config = MainConfig()
self.should_exit = asyncio.Event()
self.plugins_priority_dict = defaultdict(list)
self.plugin_state = defaultdict(lambda: None)
self.global_state = {}

self.adapters = []
self._condition = asyncio.Condition()
self._current_event = None
self._restart_flag = False
self._module_path_finder = ModulePathFinder()
Expand Down
2 changes: 1 addition & 1 deletion alicebot/utils.py
Expand Up @@ -57,7 +57,7 @@
_R = TypeVar("_R")
_TypeT = TypeVar("_TypeT", bound=Type[Any])

StrOrBytesPath: TypeAlias = Union[str, bytes, PathLike[str], PathLike[bytes]]
StrOrBytesPath: TypeAlias = Union[str, bytes, "PathLike[str]", "PathLike[bytes]"]


class ModulePathFinder(MetaPathFinder):
Expand Down

0 comments on commit 6bdcedd

Please sign in to comment.