Skip to content

Commit

Permalink
Import correct libraries
Browse files Browse the repository at this point in the history
Fixes "plugin not supported" errors with python 3.8.

PR #21539.
  • Loading branch information
Chocobo1 authored Oct 10, 2024
1 parent 403b7c7 commit 84372de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/searchengine/nova3/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VERSION: 1.47
#VERSION: 1.48

# Author:
# Christophe DUMEZ ([email protected])
Expand Down Expand Up @@ -39,8 +39,7 @@
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:
Expand Down Expand Up @@ -75,7 +74,7 @@ def getBrowserUserAgent() -> str:
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])
Expand Down
5 changes: 2 additions & 3 deletions src/searchengine/nova3/nova2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#VERSION: 1.46
#VERSION: 1.47

# Author:
# Fabien Devaux <fab AT gnux DOT info>
Expand Down Expand Up @@ -37,12 +37,11 @@
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:
Expand Down
7 changes: 3 additions & 4 deletions src/searchengine/nova3/novaprinter.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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', {
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 84372de

Please sign in to comment.