mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
ec45f704b1
* Drop python 3.6/3.7, remove unneeded compat * Remove unused import * Minimal python 3.8+ docs updates
36 lines
727 B
Python
36 lines
727 B
Python
"""Helpers for Python and platform compatibility."""
|
|
import sys
|
|
from thinc.util import copy_array
|
|
|
|
try:
|
|
import cPickle as pickle
|
|
except ImportError:
|
|
import pickle # type: ignore[no-redef]
|
|
|
|
try:
|
|
import copy_reg
|
|
except ImportError:
|
|
import copyreg as copy_reg # type: ignore[no-redef]
|
|
|
|
try:
|
|
from cupy.cuda.stream import Stream as CudaStream
|
|
except ImportError:
|
|
CudaStream = None
|
|
|
|
try:
|
|
import cupy
|
|
except ImportError:
|
|
cupy = None
|
|
|
|
from thinc.api import Optimizer # noqa: F401
|
|
|
|
pickle = pickle
|
|
copy_reg = copy_reg
|
|
CudaStream = CudaStream
|
|
cupy = cupy
|
|
copy_array = copy_array
|
|
|
|
is_windows = sys.platform.startswith("win")
|
|
is_linux = sys.platform.startswith("linux")
|
|
is_osx = sys.platform == "darwin"
|