Skip to content

Commit 372429a

Browse files
authored
Drop support for 3.7 and 3.8 (#128)
1 parent ccd80ab commit 372429a

File tree

166 files changed

+388
-471
lines changed

Some content is hidden

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

166 files changed

+388
-471
lines changed

.github/workflows/build-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.11'
18+
python-version: '3.10'
1919

2020
- name: Install dependencies AND Build Documentation
2121
env:

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-22.04, macos-14]
16-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1717

1818
steps:
1919
- uses: actions/checkout@v4

.github/workflows/scrape-errors.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
name: scrape-errors
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 1
1414
- name: Set up Python
15-
uses: actions/setup-python@v3
15+
uses: actions/setup-python@v5
1616
with:
17-
python-version: '3.9'
17+
python-version: '3.10'
1818

1919
- name: scrape
2020
run: |

compiler/api/compiler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import shutil
2323
from functools import partial
2424
from pathlib import Path
25-
from typing import NamedTuple, List, Tuple
25+
from typing import NamedTuple
2626

2727
# from autoflake import fix_code
2828
# from black import format_str, FileMode
@@ -82,7 +82,7 @@ class Combinator(NamedTuple):
8282
name: str
8383
id: str
8484
has_flags: bool
85-
args: List[Tuple[str, str]]
85+
args: list[tuple[str, str]]
8686
qualtype: str
8787
typespace: str
8888
type: str
@@ -127,7 +127,7 @@ def get_type_hint(type: str) -> str:
127127
is_core = True
128128

129129
sub_type = type.split("<")[1][:-1]
130-
type = f"List[{get_type_hint(sub_type)}]"
130+
type = f"list[{get_type_hint(sub_type)}]"
131131

132132
if is_core:
133133
return f"Optional[{type}] = None" if is_flag else type

compiler/api/template/combinator.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from io import BytesIO
55
from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
66
from pyrogram.raw.core import TLObject
77
from pyrogram import raw
8-
from typing import List, Optional, Any
8+
from typing import Optional, Any
99

1010
{warning}
1111

@@ -14,7 +14,7 @@ class {name}(TLObject): # type: ignore
1414
"""{docstring}
1515
"""
1616

17-
__slots__: List[str] = [{slots}]
17+
__slots__: list[str] = [{slots}]
1818

1919
ID = {id}
2020
QUALNAME = "{qualname}"

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = [{ name = "SpEcHIDe", email = "[email protected]" }]
66
dependencies = ["pyaes<=1.6.1", "pysocks<=1.7.1"]
77
readme = "README.md"
88
license = "LGPL-3.0-or-later"
9-
requires-python = ">=3.7"
9+
requires-python = ">=3.9"
1010
classifiers = [
1111
"Development Status :: 5 - Production/Stable",
1212
"Intended Audience :: Developers",
@@ -15,8 +15,6 @@ classifiers = [
1515
"Operating System :: OS Independent",
1616
"Programming Language :: Python",
1717
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python :: 3.7",
19-
"Programming Language :: Python :: 3.8",
2018
"Programming Language :: Python :: 3.9",
2119
"Programming Language :: Python :: 3.10",
2220
"Programming Language :: Python :: 3.11",
@@ -43,6 +41,7 @@ path = "pyrogram/__init__.py"
4341
[project.urls]
4442
Homepage = "https://telegramplayground.github.io/pyrogram/"
4543
Tracker = "https://github.com/TelegramPlayGround/Pyrogram/issues"
44+
community = "https://t.me/PyroTGFork"
4645
Source = "https://github.com/TelegramPlayGround/Pyrogram"
4746
Documentation = "https://telegramplayground.github.io/pyrogram/releases/changes-in-this-fork.html"
4847

@@ -99,6 +98,6 @@ docs = [
9998
]
10099

101100
fast = [
102-
"PyTgCrypto==1.2.6",
101+
"PyTgCrypto>1.2.9.2,<=1.4",
103102
"uvloop>0.18.0,<=0.19.0"
104103
]

pyrogram/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from io import StringIO, BytesIO
3333
from mimetypes import MimeTypes
3434
from pathlib import Path
35-
from typing import Union, List, Optional, Callable, AsyncGenerator, Type, Tuple
35+
from typing import Union, Optional, Callable, AsyncGenerator
3636

3737
import pyrogram
3838
from pyrogram import __version__, __license__
@@ -287,7 +287,7 @@ def __init__(
287287
client_platform: enums.ClientPlatform = enums.ClientPlatform.OTHER,
288288
link_preview_options: "types.LinkPreviewOptions" = None,
289289
fetch_replies: int = 1,
290-
_un_docu_gnihts: List = []
290+
_un_docu_gnihts: list = []
291291
):
292292
super().__init__()
293293

@@ -560,7 +560,7 @@ def set_parse_mode(self, parse_mode: Optional["enums.ParseMode"]):
560560

561561
self.parse_mode = parse_mode
562562

563-
async def fetch_peers(self, peers: List[Union[raw.types.User, raw.types.Chat, raw.types.Channel]]) -> bool:
563+
async def fetch_peers(self, peers: list[Union[raw.types.User, raw.types.Chat, raw.types.Channel]]) -> bool:
564564
is_min = False
565565
parsed_peers = []
566566

@@ -711,7 +711,7 @@ async def handle_updates(self, updates):
711711
elif isinstance(updates, raw.types.UpdatesTooLong):
712712
log.info(updates)
713713

714-
async def recover_gaps(self) -> Tuple[int, int]:
714+
async def recover_gaps(self) -> tuple[int, int]:
715715
states = await self.storage.update_state()
716716

717717
message_updates_counter = 0

pyrogram/errors/rpc_error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import re
2121
from datetime import datetime
2222
from importlib import import_module
23-
from typing import Type, Union
23+
from typing import Union
2424

2525
from pyrogram import __version__, raw
2626
from pyrogram.raw.core import TLObject
@@ -71,7 +71,7 @@ def __init__(
7171
f.write(f"{datetime.now()}\t{value}\t{rpc_name}\n")
7272

7373
@staticmethod
74-
def raise_it(rpc_error: "raw.types.RpcError", rpc_type: Type[TLObject]):
74+
def raise_it(rpc_error: "raw.types.RpcError", rpc_type: type[TLObject]):
7575
error_code = rpc_error.error_code
7676
is_signed = error_code < 0
7777
error_message = rpc_error.error_message

pyrogram/file_id.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import typing
2424
from enum import IntEnum
2525
from io import BytesIO
26-
from typing import List
2726

2827
from pyrogram.raw.core import Bytes, String
2928

@@ -64,7 +63,7 @@ def rle_encode(s: bytes) -> bytes:
6463
Returns:
6564
``bytes``: The encoded bytes
6665
"""
67-
r: List[int] = []
66+
r: list[int] = []
6867
n: int = 0
6968

7069
for b in s:
@@ -92,7 +91,7 @@ def rle_decode(s: bytes) -> bytes:
9291
Returns:
9392
``bytes``: The decoded bytes
9493
"""
95-
r: List[int] = []
94+
r: list[int] = []
9695
z: bool = False
9796

9897
for b in s:

pyrogram/filters.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import inspect
2020
import re
21-
from typing import Any, Callable, List, Literal, Optional, Pattern, Union
21+
from typing import Any, Callable, Literal, Optional, Pattern, Union
2222

2323
import pyrogram
2424
from pyrogram import enums
@@ -804,7 +804,7 @@ async def video_chat_ended_filter(_, __, m: Message) -> bool:
804804

805805

806806
# region business message
807-
async def tg_business_filter(_, __, m: Union[Message, List[Message]]):
807+
async def tg_business_filter(_, __, m: Union[Message, list[Message]]):
808808
if (
809809
isinstance(m, list) and
810810
len(m) > 0
@@ -916,8 +916,8 @@ async def linked_channel_filter(_, __, m: Message) -> bool:
916916

917917
# region command_filter
918918
def command(
919-
commands: Union[str, List[str]],
920-
prefixes: Union[str, List[str]] = "/",
919+
commands: Union[str, list[str]],
920+
prefixes: Union[str, list[str]] = "/",
921921
case_sensitive: bool = False,
922922
) -> Filter:
923923
"""Filter commands, i.e.: text messages starting with "/" or any other custom prefix.
@@ -1007,13 +1007,13 @@ async def func(flt, client: pyrogram.Client, message: Message) -> bool:
10071007

10081008

10091009
# region cq_data_filter
1010-
def cq_data(data: Union[str, List[str]]):
1010+
def cq_data(data: Union[str, list[str]]):
10111011
"""Filter callback query updates that match a given string or list of strings.
10121012
10131013
Can be applied to handlers that receive :obj:`~pyrogram.types.CallbackQuery` updates.
10141014
10151015
Parameters:
1016-
data (``str`` | ``List[str]``):
1016+
data (``str`` | ``list[str]``):
10171017
The data or list of data strings to match against the callback query.
10181018
10191019
Returns:
@@ -1096,7 +1096,7 @@ class user(Filter, set):
10961096
Defaults to None (no users).
10971097
"""
10981098

1099-
def __init__(self, users: Optional[Union[int, str, List[Union[int, str]]]] = None) -> None:
1099+
def __init__(self, users: Optional[Union[int, str, list[Union[int, str]]]] = None) -> None:
11001100
users = [] if users is None else users if isinstance(users, list) else [users]
11011101

11021102
super().__init__(
@@ -1133,7 +1133,7 @@ class chat(Filter, set):
11331133
Defaults to None (no chats).
11341134
"""
11351135

1136-
def __init__(self, chats: Optional[Union[int, str, List[Union[int, str]]]] = None) -> None:
1136+
def __init__(self, chats: Optional[Union[int, str, list[Union[int, str]]]] = None) -> None:
11371137
chats = [] if chats is None else chats if isinstance(chats, list) else [chats]
11381138

11391139
super().__init__(
@@ -1194,7 +1194,7 @@ class thread(Filter, set):
11941194
Defaults to None (no threads).
11951195
"""
11961196

1197-
def __init__(self, message_thread_ids: Optional[Union[int, List[int]]] = None):
1197+
def __init__(self, message_thread_ids: Optional[Union[int, list[int]]] = None):
11981198
message_thread_ids = [] if message_thread_ids is None else message_thread_ids if isinstance(message_thread_ids, list) else [message_thread_ids]
11991199

12001200
super().__init__(

0 commit comments

Comments
 (0)