diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9d0766d9..bc29c68b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,4 +36,5 @@ repos: additional_dependencies: - aiohttp<4 - rich<14 + - typing-extensions<5 - uvloop<0.20; implementation_name == "cpython" and (sys_platform == "darwin" or sys_platform == "linux") diff --git a/proxy_scraper_checker/proxy_scraper_checker.py b/proxy_scraper_checker/proxy_scraper_checker.py index 9acfd7c34..73ea31e24 100644 --- a/proxy_scraper_checker/proxy_scraper_checker.py +++ b/proxy_scraper_checker/proxy_scraper_checker.py @@ -15,8 +15,6 @@ Optional, Set, Tuple, - Type, - TypeVar, Union, ) @@ -31,6 +29,7 @@ TextColumn, ) from rich.table import Table +from typing_extensions import Self from . import sort, validators from .folder import Folder @@ -39,10 +38,6 @@ logger = logging.getLogger(__name__) -TProxyScraperChecker = TypeVar( - "TProxyScraperChecker", bound="ProxyScraperChecker" -) - class ProxyScraperChecker: """HTTP, SOCKS4, SOCKS5 proxies scraper and checker.""" @@ -157,11 +152,8 @@ def __init__( @classmethod def from_configparser( - cls: Type[TProxyScraperChecker], - cfg: ConfigParser, - *, - console: Optional[Console] = None, - ) -> TProxyScraperChecker: + cls, cfg: ConfigParser, *, console: Optional[Console] = None + ) -> Self: general = cfg["General"] folders = cfg["Folders"] http = cfg["HTTP"] diff --git a/proxy_scraper_checker/validators.py b/proxy_scraper_checker/validators.py index 327b08063..debb1178c 100644 --- a/proxy_scraper_checker/validators.py +++ b/proxy_scraper_checker/validators.py @@ -3,9 +3,11 @@ import asyncio import logging import sys -from typing import Any, Iterable, Optional +from typing import Iterable, Optional from urllib.parse import urlparse +from typing_extensions import Any + from .folder import Folder logger = logging.getLogger(__name__) diff --git a/requirements-termux.txt b/requirements-termux.txt index e94b66fbf..d530ac785 100644 --- a/requirements-termux.txt +++ b/requirements-termux.txt @@ -1,3 +1,4 @@ aiohttp-socks>=0.7,<0.9 aiohttp>=3.8,<4 rich>=12.3,<14 +typing-extensions>=4.4,<5 diff --git a/requirements.txt b/requirements.txt index 5ecbf0b9d..0037d27ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ aiodns>=3.0,<4 aiohttp-socks>=0.7,<0.9 aiohttp>=3.8,<4 rich>=12.3,<14 +typing-extensions>=4.4,<5 uvloop>=0.16,<0.20; implementation_name == "cpython" and (sys_platform == "darwin" or sys_platform == "linux")