mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Import correct libraries
Fixes "plugin not supported" errors with python 3.8. PR #21539.
This commit is contained in:
parent
403b7c7c35
commit
84372de675
3 changed files with 8 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
#VERSION: 1.47
|
#VERSION: 1.48
|
||||||
|
|
||||||
# Author:
|
# Author:
|
||||||
# Christophe DUMEZ (chris@qbittorrent.org)
|
# Christophe DUMEZ (chris@qbittorrent.org)
|
||||||
|
@ -39,8 +39,7 @@ import tempfile
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from collections.abc import Mapping
|
from typing import Any, Dict, Mapping, Match, Optional
|
||||||
from typing import Any, Dict, Optional
|
|
||||||
|
|
||||||
|
|
||||||
def getBrowserUserAgent() -> str:
|
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:
|
def htmlentitydecode(s: str) -> str:
|
||||||
# First convert alpha entities (such as é)
|
# First convert alpha entities (such as é)
|
||||||
# (Inspired from http://mail.python.org/pipermail/python-list/2007-June/443813.html)
|
# (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)
|
entity = m.group(1)
|
||||||
if entity in html.entities.name2codepoint:
|
if entity in html.entities.name2codepoint:
|
||||||
return chr(html.entities.name2codepoint[entity])
|
return chr(html.entities.name2codepoint[entity])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#VERSION: 1.46
|
#VERSION: 1.47
|
||||||
|
|
||||||
# Author:
|
# Author:
|
||||||
# Fabien Devaux <fab AT gnux DOT info>
|
# Fabien Devaux <fab AT gnux DOT info>
|
||||||
|
@ -37,12 +37,11 @@ import importlib
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from collections.abc import Iterable, Iterator, Sequence
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from multiprocessing import Pool, cpu_count
|
from multiprocessing import Pool, cpu_count
|
||||||
from os import path
|
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
|
THREADED: bool = True
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#VERSION: 1.50
|
#VERSION: 1.51
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -25,8 +25,7 @@
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from collections.abc import Mapping
|
from typing import Any, Mapping, Pattern, Union
|
||||||
from typing import Any, Union
|
|
||||||
|
|
||||||
# TODO: enable the following when using Python >= 3.8
|
# TODO: enable the following when using Python >= 3.8
|
||||||
#SearchResults = TypedDict('SearchResults', {
|
#SearchResults = TypedDict('SearchResults', {
|
||||||
|
@ -59,7 +58,7 @@ def prettyPrinter(dictionary: SearchResults) -> None:
|
||||||
print(outtext, file=utf8stdout)
|
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:
|
def anySizeToBytes(size_string: Union[float, int, str]) -> int:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue