Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from numcodecs.lzma import LZMA
register_codec(LZMA)
except ImportError: # pragma: no cover
pass
try:
from numcodecs import blosc
from numcodecs.blosc import Blosc
register_codec(Blosc)
# initialize blosc
try:
ncores = multiprocessing.cpu_count()
except OSError: # pragma: no cover
ncores = 1
blosc.init()
blosc.set_nthreads(min(8, ncores))
atexit.register(blosc.destroy)
except ImportError: # pragma: no cover
pass
try:
from numcodecs import zstd
from numcodecs.zstd import Zstd
register_codec(Zstd)
except ImportError: # pragma: no cover
pass
try:
from numcodecs import lz4
from numcodecs.lz4 import LZ4
register_codec(LZ4)
except ImportError: # pragma: no cover