Drop Python 3.6 support (#3133)

This commit is contained in:
Noémi Ványi 2022-01-16 15:04:32 +01:00 committed by GitHub
parent 491208832d
commit f0842c76e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 32 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
steps:
- name: Checkout
uses: actions/checkout@v2

View File

@ -4,6 +4,7 @@ import asyncio
import threading
import concurrent.futures
from time import time
from queue import SimpleQueue
import httpx
import h2.exceptions
@ -12,29 +13,6 @@ 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):
raise Empty
return self._queue.popleft()
THREADLOCAL = threading.local()

View File

@ -3,6 +3,7 @@
import asyncio
import logging
import threading
import uvloop
import httpcore
import httpx
@ -17,14 +18,6 @@ import python_socks._errors
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')
LOOP = None