Import correct libraries

Fixes "plugin not supported" errors with python 3.8.

PR #21539.
This commit is contained in:
Chocobo1 2024-10-10 16:29:51 +08:00 committed by GitHub
parent 403b7c7c35
commit 84372de675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 11 deletions

View file

@ -1,4 +1,4 @@
#VERSION: 1.47
#VERSION: 1.48
# Author:
# Christophe DUMEZ (chris@qbittorrent.org)
@ -39,8 +39,7 @@ import tempfile
import urllib.error
import urllib.parse
import urllib.request
from collections.abc import Mapping
from typing import Any, Dict, Optional
from typing import Any, Dict, Mapping, Match, Optional
def getBrowserUserAgent() -> str:
@ -75,7 +74,7 @@ if "sock_proxy" in os.environ and len(os.environ["sock_proxy"].strip()) > 0:
def htmlentitydecode(s: str) -> str:
# First convert alpha entities (such as é)
# (Inspired from http://mail.python.org/pipermail/python-list/2007-June/443813.html)
def entity2char(m: re.Match[str]) -> str:
def entity2char(m: Match[str]) -> str:
entity = m.group(1)
if entity in html.entities.name2codepoint:
return chr(html.entities.name2codepoint[entity])

View file

@ -1,4 +1,4 @@
#VERSION: 1.46
#VERSION: 1.47
# Author:
# Fabien Devaux <fab AT gnux DOT info>
@ -37,12 +37,11 @@ import importlib
import pathlib
import sys
import urllib.parse
from collections.abc import Iterable, Iterator, Sequence
from enum import Enum
from glob import glob
from multiprocessing import Pool, cpu_count
from os import path
from typing import Dict, List, Optional, Set, Tuple, Type
from typing import Dict, Iterable, Iterator, List, Optional, Sequence, Set, Tuple, Type
THREADED: bool = True
try:

View file

@ -1,4 +1,4 @@
#VERSION: 1.50
#VERSION: 1.51
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@ -25,8 +25,7 @@
# POSSIBILITY OF SUCH DAMAGE.
import re
from collections.abc import Mapping
from typing import Any, Union
from typing import Any, Mapping, Pattern, Union
# TODO: enable the following when using Python >= 3.8
#SearchResults = TypedDict('SearchResults', {
@ -59,7 +58,7 @@ def prettyPrinter(dictionary: SearchResults) -> None:
print(outtext, file=utf8stdout)
sizeUnitRegex: re.Pattern[str] = re.compile(r"^(?P<size>\d*\.?\d+) *(?P<unit>[a-z]+)?", re.IGNORECASE)
sizeUnitRegex: Pattern[str] = re.compile(r"^(?P<size>\d*\.?\d+) *(?P<unit>[a-z]+)?", re.IGNORECASE)
def anySizeToBytes(size_string: Union[float, int, str]) -> int: