Skip to content

Commit 56df1c7

Browse files
authored
💥 Remove: 移除 Python 3.8 支持 (#28)
1 parent acb078b commit 56df1c7

File tree

10 files changed

+286
-319
lines changed

10 files changed

+286
-319
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ _✨ GitHub 协议适配 ✨_
2323
<a href="https://pypi.python.org/pypi/nonebot-adapter-github">
2424
<img src="https://img.shields.io/pypi/v/nonebot-adapter-github" alt="pypi">
2525
</a>
26-
<img src="https://img.shields.io/badge/python-3.8+-blue" alt="python">
26+
<img src="https://img.shields.io/badge/python-3.9+-blue" alt="python">
2727
<a href="https://results.pre-commit.ci/latest/github/nonebot/adapter-github/master">
28-
<img src="https://results.pre-commit.ci/badge/github/nonebot/adapter-github/master.svg" />
28+
<img src="https://results.pre-commit.ci/badge/github/nonebot/adapter-github/master.svg" alt="pre-commit"/>
2929
</a>
3030
<br />
3131
<a href="https://jq.qq.com/?_wv=1027&k=5OFifDh">

nonebot/adapters/github/adapter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from functools import partial
33
import inspect
44
import json
5-
from typing import Any, Callable, Optional, Type, Union, cast
5+
from typing import Any, Callable, Optional, Union, cast
66
from typing_extensions import override
77

88
from githubkit.exception import GraphQLFailed, RequestFailed, RequestTimeout
@@ -29,7 +29,7 @@
2929
from .utils import log
3030

3131

32-
def import_event_model(event_name: str) -> Type[Event]:
32+
def import_event_model(event_name: str) -> type[Event]:
3333
return getattr(event, event_name)
3434

3535

nonebot/adapters/github/bot.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
from collections.abc import AsyncGenerator
12
from contextlib import asynccontextmanager
23
from contextvars import ContextVar
34
import re
45
from typing import (
56
TYPE_CHECKING,
67
Any,
7-
AsyncGenerator,
88
Callable,
9-
Dict,
109
Generic,
11-
List,
1210
Optional,
1311
TypeVar,
1412
Union,
@@ -134,8 +132,8 @@ class Bot(BaseBot, Generic[A]):
134132
rest: RestVersionSwitcher
135133

136134
async def async_graphql(
137-
self, query: str, variables: Optional[Dict[str, Any]] = None
138-
) -> Dict[str, Any]: ...
135+
self, query: str, variables: Optional[dict[str, Any]] = None
136+
) -> dict[str, Any]: ...
139137

140138
@override
141139
def __init__(self, adapter: "Adapter", app: Union[GitHubApp, OAuthApp]):
@@ -247,8 +245,8 @@ async def as_oauth_app(self) -> AsyncGenerator[Self, None]:
247245
async def as_installation(
248246
self,
249247
installation_id: int,
250-
repositories: Union[Unset, List[str]] = UNSET,
251-
repository_ids: Union[Unset, List[int]] = UNSET,
248+
repositories: Union[Unset, list[str]] = UNSET,
249+
repository_ids: Union[Unset, list[int]] = UNSET,
252250
permissions: Union[Unset, "AppPermissionsType"] = UNSET,
253251
) -> AsyncGenerator[Self, None]:
254252
if self._ctx_github.get() is not None:

nonebot/adapters/github/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List, Optional, Union
1+
from typing import Any, Optional, Union
22

33
from pydantic import BaseModel, Field
44

@@ -35,8 +35,8 @@ def concat_key(cls, value: object) -> Any:
3535
class Config(BaseModel):
3636
"""GitHub Adapter Config"""
3737

38-
github_apps: List[Union[GitHubApp, OAuthApp]] = Field(default_factory=list)
38+
github_apps: list[Union[GitHubApp, OAuthApp]] = Field(default_factory=list)
3939
"""Allowed GitHub App List"""
4040
github_base_url: Optional[str] = None
4141
github_accept_format: Optional[str] = None
42-
github_previews: Optional[List[str]] = None
42+
github_previews: Optional[list[str]] = None

nonebot/adapters/github/event/_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict
1+
from typing import Any
22
from typing_extensions import override
33

44
from github.message import Message
@@ -10,7 +10,7 @@
1010
class Event(BaseEvent):
1111
id: str
1212
name: str
13-
payload: Dict[str, Any]
13+
payload: dict[str, Any]
1414

1515
to_me: bool = False
1616

nonebot/adapters/github/lazy_module.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
from collections.abc import Sequence
12
import importlib
23
from importlib.abc import MetaPathFinder
34
from importlib.machinery import ModuleSpec, PathFinder, SourceFileLoader
45
from itertools import chain
56
import re
67
import sys
78
from types import ModuleType
8-
from typing import Any, Dict, List, Optional, Sequence, Tuple
9+
from typing import Any, Optional
910

1011
LAZY_MODULES = (r"^nonebot\.adapters\.github\.event$",)
1112

1213

1314
class LazyModule(ModuleType):
14-
__lazy_vars__: Dict[str, List[str]]
15-
__lazy_vars_validated__: Optional[Dict[str, List[str]]]
16-
__lazy_vars_mapping__: Dict[str, str]
15+
__lazy_vars__: dict[str, list[str]]
16+
__lazy_vars_validated__: Optional[dict[str, list[str]]]
17+
__lazy_vars_mapping__: dict[str, str]
1718

1819
@property
19-
def __all__(self) -> Tuple[str, ...]:
20+
def __all__(self) -> tuple[str, ...]:
2021
lazy_vars = self.__lazy_vars_validated__
2122
if lazy_vars is None:
2223
return ()

nonebot/adapters/github/message.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Iterable, Type
1+
from collections.abc import Iterable
22
from typing_extensions import override
33

44
from nonebot.adapters import Message as BaseMessage
@@ -8,7 +8,7 @@
88
class MessageSegment(BaseMessageSegment["Message"]):
99
@classmethod
1010
@override
11-
def get_message_class(cls) -> Type["Message"]:
11+
def get_message_class(cls) -> type["Message"]:
1212
return Message
1313

1414
@override
@@ -29,7 +29,7 @@ def markdown(text: str) -> "MessageSegment":
2929
class Message(BaseMessage[MessageSegment]):
3030
@classmethod
3131
@override
32-
def get_segment_class(cls) -> Type[MessageSegment]:
32+
def get_segment_class(cls) -> type[MessageSegment]:
3333
return MessageSegment
3434

3535
@staticmethod

nonebot/adapters/github/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import contextlib
22
import re
3-
from typing import TYPE_CHECKING, Any, Tuple
3+
from typing import TYPE_CHECKING, Any
44

55
from nonebot.utils import logger_wrapper
66

@@ -22,7 +22,7 @@ def get_attr_or_item(obj: Any, attr: str) -> Any:
2222
class APIContext:
2323
__slots__ = ("bot", "parts")
2424

25-
def __init__(self, bot: "Bot", parts: Tuple[str, ...]):
25+
def __init__(self, bot: "Bot", parts: tuple[str, ...]):
2626
self.bot = bot
2727
self.parts = parts
2828

0 commit comments

Comments
 (0)