conditional import

This commit is contained in:
Akinwale Ariwodola 2020-09-28 20:06:57 +01:00 committed by Lex Berezhny
parent 310c61a5cc
commit 838cc60161

View file

@ -8,7 +8,6 @@ from collections import defaultdict
from dataclasses import dataclass from dataclasses import dataclass
from contextvars import ContextVar from contextvars import ContextVar
from concurrent.futures.thread import ThreadPoolExecutor from concurrent.futures.thread import ThreadPoolExecutor
from concurrent.futures.process import ProcessPoolExecutor
from typing import Tuple, List, Union, Callable, Any, Awaitable, Iterable, Dict, Optional from typing import Tuple, List, Union, Callable, Any, Awaitable, Iterable, Dict, Optional
from datetime import date from datetime import date
from prometheus_client import Gauge, Counter, Histogram from prometheus_client import Gauge, Counter, Histogram
@ -65,6 +64,7 @@ def run_read_only_fetchone(sql, params):
if platform.system() == 'Windows' or 'ANDROID_ARGUMENT' or 'KIVY_BUILD' in os.environ: if platform.system() == 'Windows' or 'ANDROID_ARGUMENT' or 'KIVY_BUILD' in os.environ:
ReaderExecutorClass = ThreadPoolExecutor ReaderExecutorClass = ThreadPoolExecutor
else: else:
from concurrent.futures.process import ProcessPoolExecutor
ReaderExecutorClass = ProcessPoolExecutor ReaderExecutorClass = ProcessPoolExecutor