diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5aadfa3b..f5bfcb08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.10 + rev: v0.11.4 hooks: - id: ruff args: [--fix] diff --git a/nonebot/config.py b/nonebot/config.py index c49c012f..5a1fa132 100644 --- a/nonebot/config.py +++ b/nonebot/config.py @@ -175,8 +175,7 @@ class DotEnvSettingsSource(BaseSettingsSource): continue # delete from file vars when used - if env_name in env_file_vars: - del env_file_vars[env_name] + env_file_vars.pop(env_name, None) _, *keys, last_key = env_name.split(self.env_nested_delimiter) env_var = result diff --git a/nonebot/internal/adapter/message.py b/nonebot/internal/adapter/message.py index 1492c440..80607c9b 100644 --- a/nonebot/internal/adapter/message.py +++ b/nonebot/internal/adapter/message.py @@ -51,10 +51,10 @@ class MessageSegment(abc.ABC, Generic[TM]): ) -> bool: return not self == other - def __add__(self: TMS, other: Union[str, TMS, Iterable[TMS]]) -> TM: + def __add__(self, other: Union[str, Self, Iterable[Self]]) -> TM: return self.get_message_class()(self) + other - def __radd__(self: TMS, other: Union[str, TMS, Iterable[TMS]]) -> TM: + def __radd__(self, other: Union[str, Self, Iterable[Self]]) -> TM: return self.get_message_class()(other) + self @classmethod @@ -87,7 +87,7 @@ class MessageSegment(abc.ABC, Generic[TM]): def items(self): return asdict(self).items() - def join(self: TMS, iterable: Iterable[Union[TMS, TM]]) -> TM: + def join(self, iterable: Iterable[Union[Self, TM]]) -> TM: return self.get_message_class()(self).join(iterable) def copy(self) -> Self: