on master help sign in
Drop Python 3.6 support (#3133)
f0842c7Noémi Ványi
.github/workflows/integration.yml+1−1
@@ -13,7 +13,7 @@ jobs:
13 strategy:
13 strategy:
14 matrix:
14 matrix:
15 os: [ubuntu-20.04]
15 os: [ubuntu-20.04]
16− python-version: [3.6, 3.7, 3.8, 3.9]
16+ python-version: [3.7, 3.8, 3.9]
17 steps:
17 steps:
18 - name: Checkout
18 - name: Checkout
19 uses: actions/checkout@v2
19 uses: actions/checkout@v2
searx/network/__init__.py+1−23
@@ -4,6 +4,7 @@ import asyncio
4import threading
4import threading
5import concurrent.futures
5import concurrent.futures
6from time import time
6from time import time
7+from queue import SimpleQueue
7
8
8import httpx
9import httpx
9import h2.exceptions
10import h2.exceptions
@@ -12,29 +13,6 @@ from .network import get_network, initialize, check_network_configuration
12from .client import get_loop
13from .client import get_loop
13from .raise_for_httperror import raise_for_httperror
14from .raise_for_httperror import raise_for_httperror
14
15
15−# queue.SimpleQueue: Support Python 3.6
16−try:
17− from queue import SimpleQueue
18−except ImportError:
19− from queue import Empty
20− from collections import deque
21−
22− class SimpleQueue:
23− """Minimal backport of queue.SimpleQueue"""
24−
25− def __init__(self):
26− self._queue = deque()
27− self._count = threading.Semaphore(0)
28−
29− def put(self, item):
30− self._queue.append(item)
31− self._count.release()
32−
33− def get(self):
34− if not self._count.acquire(True):
35− raise Empty
36− return self._queue.popleft()
37−
38
16
39THREADLOCAL = threading.local()
17THREADLOCAL = threading.local()
40
18
searx/network/client.py+1−8
@@ -3,6 +3,7 @@
3import asyncio
3import asyncio
4import logging
4import logging
5import threading
5import threading
6+import uvloop
6
7
7import httpcore
8import httpcore
8import httpx
9import httpx
@@ -17,14 +18,6 @@ import python_socks._errors
17
18
18from searx import logger
19from searx import logger
19
20
20−# Optional uvloop (support Python 3.6)
21−try:
22− import uvloop
23−except ImportError:
24− pass
25−else:
26− uvloop.install()
27−
28
21
29logger = logger.getChild('searx.http.client')
22logger = logger.getChild('searx.http.client')
30LOOP = None
23LOOP = None