mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-09-11 21:27:37 +03:00
python: use TypedDict from typing_extensions on python 3.9 and 3.10
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
parent
adea3811ea
commit
446668674e
@ -9,13 +9,19 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Any, Callable, Generic, Iterable, TypedDict, TypeVar, overload
|
from typing import Any, Callable, Generic, Iterable, TypeVar, overload
|
||||||
|
|
||||||
if sys.version_info >= (3, 9):
|
if sys.version_info >= (3, 9):
|
||||||
import importlib.resources as importlib_resources
|
import importlib.resources as importlib_resources
|
||||||
else:
|
else:
|
||||||
import importlib_resources
|
import importlib_resources
|
||||||
|
|
||||||
|
if (3, 9) <= sys.version_info < (3, 11):
|
||||||
|
# python 3.9 broke generic TypedDict, python 3.11 fixed it
|
||||||
|
from typing_extensions import TypedDict
|
||||||
|
else:
|
||||||
|
from typing import TypedDict
|
||||||
|
|
||||||
EmbeddingsType = TypeVar('EmbeddingsType', bound='list[Any]')
|
EmbeddingsType = TypeVar('EmbeddingsType', bound='list[Any]')
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ setup(
|
|||||||
'requests',
|
'requests',
|
||||||
'tqdm',
|
'tqdm',
|
||||||
'importlib_resources; python_version < "3.9"',
|
'importlib_resources; python_version < "3.9"',
|
||||||
|
'typing-extensions>=4.3.0; python_version >= "3.9" and python_version < "3.11"',
|
||||||
],
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
'dev': [
|
'dev': [
|
||||||
|
Loading…
Reference in New Issue
Block a user