on master help sign in
Drop Python 3.6 support (#3133)
commitf0842c76e5166504bf4a2f7274659e9c1074f4d5 authorNoémi Ványi <kvch@users.noreply.github.com> dateSun 16 Jan 2022, 15:04 (5 years ago) parent4912088
3 files changed+3−32
.github/workflows/integration.yml+1−1 searx/network/__init__.py+1−23 searx/network/client.py+1−8
.github/workflows/integration.yml+1−1
@@ -13,7 +13,7 @@ jobs:
1313 strategy:
1414 matrix:
1515 os: [ubuntu-20.04]
16− python-version: [3.6, 3.7, 3.8, 3.9]
16+ python-version: [3.7, 3.8, 3.9]
1717 steps:
1818 - name: Checkout
1919 uses: actions/checkout@v2
searx/network/__init__.py+1−23
@@ -4,6 +4,7 @@ import asyncio
44import threading
55import concurrent.futures
66from time import time
7+from queue import SimpleQueue
78
89import httpx
910import h2.exceptions
@@ -12,29 +13,6 @@ from .network import get_network, initialize, check_network_configuration
1213from .client import get_loop
1314from .raise_for_httperror import raise_for_httperror
1415
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−
3816
3917THREADLOCAL = threading.local()
4018
searx/network/client.py+1−8
@@ -3,6 +3,7 @@
33import asyncio
44import logging
55import threading
6+import uvloop
67
78import httpcore
89import httpx
@@ -17,14 +18,6 @@ import python_socks._errors
1718
1819from searx import logger
1920
20−# Optional uvloop (support Python 3.6)
21−try:
22− import uvloop
23−except ImportError:
24− pass
25−else:
26− uvloop.install()
27−
2821
2922logger = logger.getChild('searx.http.client')
3023LOOP = None