Skip to content

Commit 9085a4c

Browse files
committed
- 3.10 updates
1 parent 13b549e commit 9085a4c

155 files changed

Lines changed: 1439 additions & 1368 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-22.04
88
strategy:
99
matrix:
10-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
10+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1111

1212
steps:
1313
- name: Setup dependencies

pybotx/async_buffer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import abc
22
import os
3-
from typing import Optional
43

5-
try:
6-
from typing import Protocol
7-
except ImportError:
8-
from typing_extensions import Protocol
4+
from typing import Protocol
95

106

117
class AsyncBufferBase(Protocol):
@@ -27,7 +23,7 @@ class AsyncBufferReadable(AsyncBufferBase):
2723
@abc.abstractmethod
2824
async def read(
2925
self,
30-
bytes_to_read: Optional[int] = None,
26+
bytes_to_read: int | None = None,
3127
) -> bytes: ... # pragma: no cover
3228

3329

pybotx/auth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import secrets
22
import time
33
from enum import Enum
4-
from typing import Optional
54
from uuid import UUID
65

76
import jwt
@@ -17,8 +16,8 @@ def build_botx_jwt_v2(
1716
bot_id: UUID,
1817
bot_host: str,
1918
secret_key: str,
20-
issued_at: Optional[int] = None,
21-
token_id: Optional[str] = None,
19+
issued_at: int | None = None,
20+
token_id: str | None = None,
2221
) -> str:
2322
iat = int(time.time()) if issued_at is None else issued_at
2423
jti = token_id or secrets.token_hex(12)

pybotx/bot/api/responses/bot_disabled.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from dataclasses import asdict, dataclass, field
2-
from typing import Any, Dict, List, Literal
2+
from typing import Any, Literal
33

44

5-
@dataclass
5+
@dataclass(slots=True)
66
class BotAPIBotDisabledErrorData:
77
status_message: str
88

99

10-
@dataclass
10+
@dataclass(slots=True)
1111
class BotAPIBotDisabledResponse:
1212
"""Disabled bot response model.
1313
@@ -16,11 +16,11 @@ class BotAPIBotDisabledResponse:
1616
"""
1717

1818
error_data: BotAPIBotDisabledErrorData
19-
errors: List[str] = field(default_factory=list)
19+
errors: list[str] = field(default_factory=list)
2020
reason: Literal["bot_disabled"] = "bot_disabled"
2121

2222

23-
def build_bot_disabled_response(status_message: str) -> Dict[str, Any]:
23+
def build_bot_disabled_response(status_message: str) -> dict[str, Any]:
2424
"""Build bot disabled response for BotX.
2525
2626
It should be sent if the bot can't process the command.

pybotx/bot/api/responses/command_accepted.py

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

33

4-
def build_command_accepted_response() -> Dict[str, Any]:
4+
def build_command_accepted_response() -> dict[str, Any]:
55
"""Build accepted response for BotX.
66
77
It should be sent if the bot started processing a command.

pybotx/bot/api/responses/unverified_request.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from dataclasses import asdict, dataclass, field
2-
from typing import Any, Dict, List, Literal
2+
from typing import Any, Literal
33

44

5-
@dataclass
5+
@dataclass(slots=True)
66
class BotAPIUnverifiedRequestErrorData:
77
status_message: str
88

99

10-
@dataclass
10+
@dataclass(slots=True)
1111
class BotAPIUnverifiedRequestResponse:
1212
"""`Unverified request` response model.
1313
@@ -16,11 +16,11 @@ class BotAPIUnverifiedRequestResponse:
1616
"""
1717

1818
error_data: BotAPIUnverifiedRequestErrorData
19-
errors: List[str] = field(default_factory=list)
19+
errors: list[str] = field(default_factory=list)
2020
reason: Literal["unverified_request"] = "unverified_request"
2121

2222

23-
def build_unverified_request_response(status_message: str) -> Dict[str, Any]:
23+
def build_unverified_request_response(status_message: str) -> dict[str, Any]:
2424
"""Build `unverified request` response for BotX.
2525
2626
It should be sent if the header with the authorization token is missing or

0 commit comments

Comments
 (0)