summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2022-01-29 08:54:12 +0100
committerAlexandre Flament <alex@al-f.net>2022-01-29 08:54:12 +0100
commitf3f61df6a064bf6b10660070c4de4eb6112c4dc6 (patch)
treec140ce4f915073bc737b8366df2dee469dd1acc7
parent8f100d7046cad3fa5ed2fbacdd69e2825a4660a7 (diff)
downloadsearxng-f3f61df6a064bf6b10660070c4de4eb6112c4dc6.tar.gz
searxng-f3f61df6a064bf6b10660070c4de4eb6112c4dc6.zip
[mod] remove deprecate code
remove code to support Python 3.5 and Python 3.6
-rw-r--r--searx/data/__init__.py2
-rw-r--r--searx/network/__init__.py25
2 files changed, 2 insertions, 25 deletions
diff --git a/searx/data/__init__.py b/searx/data/__init__.py
index 87bfb5477..424440a71 100644
--- a/searx/data/__init__.py
+++ b/searx/data/__init__.py
@@ -38,7 +38,7 @@ def ahmia_blacklist_loader():
This function is used by :py:mod:`searx.plugins.ahmia_filter`.
"""
- with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
+ with open(data_dir / 'ahmia_blacklist.txt', encoding='utf-8') as f:
return f.read().split()
diff --git a/searx/network/__init__.py b/searx/network/__init__.py
index ced76243d..e8dddd6a0 100644
--- a/searx/network/__init__.py
+++ b/searx/network/__init__.py
@@ -5,41 +5,18 @@
import asyncio
import threading
import concurrent.futures
+from queue import SimpleQueue
from types import MethodType
from timeit import default_timer
from typing import Iterable, Tuple
import httpx
import anyio
-import h2.exceptions
from .network import get_network, initialize, check_network_configuration
from .client import get_loop
from .raise_for_httperror import raise_for_httperror
-# queue.SimpleQueue: Support Python 3.6
-try:
- from queue import SimpleQueue
-except ImportError:
- from queue import Empty
- from collections import deque
-
- class SimpleQueue:
- """Minimal backport of queue.SimpleQueue"""
-
- def __init__(self):
- self._queue = deque()
- self._count = threading.Semaphore(0)
-
- def put(self, item):
- self._queue.append(item)
- self._count.release()
-
- def get(self):
- if not self._count.acquire(True): # pylint: disable=consider-using-with
- raise Empty
- return self._queue.popleft()
-
THREADLOCAL = threading.local()
"""Thread-local data is data for thread specific values."""