mirror of
https://github.com/searx/searx
synced 2025-02-23 23:27:44 +01:00
Drop Python 3.6 support (#3133)
This commit is contained in:
parent
491208832d
commit
f0842c76e5
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-20.04]
|
os: [ubuntu-20.04]
|
||||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
python-version: [3.7, 3.8, 3.9]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -4,6 +4,7 @@ import asyncio
|
|||||||
import threading
|
import threading
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
from time import time
|
from time import time
|
||||||
|
from queue import SimpleQueue
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
import h2.exceptions
|
import h2.exceptions
|
||||||
@ -12,29 +13,6 @@ from .network import get_network, initialize, check_network_configuration
|
|||||||
from .client import get_loop
|
from .client import get_loop
|
||||||
from .raise_for_httperror import raise_for_httperror
|
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):
|
|
||||||
raise Empty
|
|
||||||
return self._queue.popleft()
|
|
||||||
|
|
||||||
|
|
||||||
THREADLOCAL = threading.local()
|
THREADLOCAL = threading.local()
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
import uvloop
|
||||||
|
|
||||||
import httpcore
|
import httpcore
|
||||||
import httpx
|
import httpx
|
||||||
@ -17,14 +18,6 @@ import python_socks._errors
|
|||||||
|
|
||||||
from searx import logger
|
from searx import logger
|
||||||
|
|
||||||
# Optional uvloop (support Python 3.6)
|
|
||||||
try:
|
|
||||||
import uvloop
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
uvloop.install()
|
|
||||||
|
|
||||||
|
|
||||||
logger = logger.getChild('searx.http.client')
|
logger = logger.getChild('searx.http.client')
|
||||||
LOOP = None
|
LOOP = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user