diff --git a/.github/workflows/pytest-builds.yml b/.github/workflows/pytest-builds.yml index f4ccb1d..3458af2 100644 --- a/.github/workflows/pytest-builds.yml +++ b/.github/workflows/pytest-builds.yml @@ -31,7 +31,7 @@ jobs: python -m pip install -U pip python -m pip install -U pytest coverage pytest-cov python -m pip install git+https://github.com/pydicom/pylibjpeg-data - python -m pip install . -vv + python -m pip install . - name: Run pytest run: | diff --git a/.gitignore b/.gitignore index 0a3fd54..1347091 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ __pycache__/ # Distribution / packaging .Python -build/ +#build/ develop-eggs/ dist/ downloads/ diff --git a/build.py b/build.py index c98e648..b6d4824 100644 --- a/build.py +++ b/build.py @@ -8,6 +8,7 @@ PACKAGE_DIR = Path(__file__).parent / "openjpeg" +BUILD_TOOLS = PACKAGE_DIR.parent / "build_tools" OPENJPEG_SRC = PACKAGE_DIR / "src" / "openjpeg" / "src" / "lib" / "openjp2" INTERFACE_SRC = PACKAGE_DIR / "src" / "interface" @@ -50,6 +51,8 @@ def build(setup_kwargs: Any) -> Any: relative_ext = output.relative_to(cmd.build_lib) shutil.copyfile(output, relative_ext) + reset_oj() + return setup_kwargs @@ -77,14 +80,42 @@ def get_source_files() -> List[Path]: def setup_oj() -> None: """Run custom cmake.""" - base_dir = os.path.join("openjpeg", "src", "openjpeg") + base_dir = PACKAGE_DIR / "src" / "openjpeg" + p_openjpeg = base_dir / "src" / "lib" / "openjp2" / "openjpeg.c" + + # Backup original CMakeLists.txt and openjpeg.c files + backup_dir = BUILD_TOOLS / "backup" + if os.path.exists(backup_dir): + shutil.rmtree(backup_dir) + + backup_dir.mkdir(exist_ok=True, parents=True) + + shutil.copy( + base_dir / "CMakeLists.txt", + backup_dir / "CMakeLists.txt.backup", + ) + shutil.copy( + p_openjpeg, + backup_dir / "openjpeg.c.backup", + ) # Copy custom CMakeLists.txt file to openjpeg base dir shutil.copy( - os.path.join("build_tools", "cmake", "CMakeLists.txt"), - base_dir + BUILD_TOOLS / "cmake" / "CMakeLists.txt", + base_dir, ) - build_dir = os.path.join(base_dir, "build") + # Edit openjpeg.c to remove the OPJ_API declaration + with p_openjpeg.open("r") as f: + data = f.readlines() + + data = [ + line.replace("OPJ_API ", "") + if line.startswith("OPJ_API ") else line for line in data + ] + with p_openjpeg.open("w") as f: + f.write("".join(data)) + + build_dir = base_dir / "build" if os.path.exists(build_dir): shutil.rmtree(build_dir) @@ -106,3 +137,31 @@ def setup_oj() -> None: with open(INTERFACE_SRC / "opj_config.h", "a") as f: f.write("\n") f.write("#define USE_JPIP 0") + + +def reset_oj() -> None: + # Restore submodule to original state + # Restore CMakeLists.txt and openjpeg.c files + base_dir = PACKAGE_DIR / "src" / "openjpeg" + build_dir = base_dir / "build" + backup_dir = BUILD_TOOLS / "backup" + p_openjpeg = base_dir / "src" / "lib" / "openjp2" / "openjpeg.c" + + if (backup_dir / "CMakeLists.txt.backup").exists(): + shutil.copy( + backup_dir / "CMakeLists.txt.backup", + base_dir / "CMakeLists.txt", + ) + + if (backup_dir / "openjpeg.c.backup").exists(): + shutil.copy( + BUILD_TOOLS / "backup" / "openjpeg.c.backup", + p_openjpeg, + ) + + # Cleanup added directories + if os.path.exists(build_dir): + shutil.rmtree(build_dir) + + if os.path.exists(backup_dir): + shutil.rmtree(backup_dir) diff --git a/build_tools/cmake/CMakeLists.txt b/build_tools/cmake/CMakeLists.txt index 3163c8a..c31e03c 100644 --- a/build_tools/cmake/CMakeLists.txt +++ b/build_tools/cmake/CMakeLists.txt @@ -95,6 +95,35 @@ include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN) endif() +#----------------------------------------------------------------------------- +# OpenJPEG build configuration options. +option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON) +option(BUILD_STATIC_LIBS "Build OpenJPEG static library." ON) +set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.") +set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.") +mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) + +set(BUILD_SHARED_LIBS ON) + +#----------------------------------------------------------------------------- +# configure name mangling to allow multiple libraries to coexist +# peacefully +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in) +set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in + ${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h + @ONLY) +endif() + +#----------------------------------------------------------------------------- +# Compiler specific flags: +if(CMAKE_COMPILER_IS_GNUCC) + # For all builds, make sure openjpeg is std99 compliant: + # set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build. + # Do not use ffast-math for all build, it would produce incorrect results, only set for release: + set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$:-ffast-math>") + set(OPENJP2_COMPILE_OPTIONS ${OPENJP2_COMPILE_OPTIONS} "$<$:-ffast-math>" -Wall -Wextra -Wconversion -Wunused-parameter -Wdeclaration-after-statement -Werror=declaration-after-statement) +endif() #----------------------------------------------------------------------------- # opj_config.h generation (1/2) diff --git a/openjpeg/_openjpeg.c b/openjpeg/_openjpeg.c index 2f6c9ae..d445045 100644 --- a/openjpeg/_openjpeg.c +++ b/openjpeg/_openjpeg.c @@ -4,16 +4,16 @@ { "distutils": { "depends": [ - "/tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h", - "/tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h", - "/tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h", - "/tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h", - "/tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h" + "/tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/core/include/numpy/arrayobject.h", + "/tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/core/include/numpy/arrayscalars.h", + "/tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/core/include/numpy/ndarrayobject.h", + "/tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/core/include/numpy/ndarraytypes.h", + "/tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/core/include/numpy/ufuncobject.h" ], "include_dirs": [ "/home/dean/Coding/src/pylibjpeg-openjpeg/openjpeg/src/openjpeg/src/lib/openjp2", "/home/dean/Coding/src/pylibjpeg-openjpeg/openjpeg/src/interface", - "/tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/core/include" + "/tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/core/include" ], "language": "c", "name": "_openjpeg", @@ -21,33 +21,35 @@ "openjpeg/_openjpeg.pyx", "openjpeg/src/interface/decode.c", "openjpeg/src/interface/color.c", - "openjpeg/src/openjpeg/src/lib/openjp2/function_list.c", - "openjpeg/src/openjpeg/src/lib/openjp2/pi.c", - "openjpeg/src/openjpeg/src/lib/openjp2/t2.c", - "openjpeg/src/openjpeg/src/lib/openjp2/t1_generate_luts.c", - "openjpeg/src/openjpeg/src/lib/openjp2/bio.c", - "openjpeg/src/openjpeg/src/lib/openjp2/j2k.c", - "openjpeg/src/openjpeg/src/lib/openjp2/tgt.c", + "openjpeg/src/openjpeg/src/lib/openjp2/openjpeg.c", + "openjpeg/src/openjpeg/src/lib/openjp2/cio.c", "openjpeg/src/openjpeg/src/lib/openjp2/sparse_array.c", - "openjpeg/src/openjpeg/src/lib/openjp2/jp2.c", - "openjpeg/src/openjpeg/src/lib/openjp2/mct.c", - "openjpeg/src/openjpeg/src/lib/openjp2/opj_malloc.c", - "openjpeg/src/openjpeg/src/lib/openjp2/event.c", - "openjpeg/src/openjpeg/src/lib/openjp2/ppix_manager.c", - "openjpeg/src/openjpeg/src/lib/openjp2/dwt.c", - "openjpeg/src/openjpeg/src/lib/openjp2/t1.c", - "openjpeg/src/openjpeg/src/lib/openjp2/phix_manager.c", + "openjpeg/src/openjpeg/src/lib/openjp2/tgt.c", + "openjpeg/src/openjpeg/src/lib/openjp2/mqc.c", "openjpeg/src/openjpeg/src/lib/openjp2/thread.c", + "openjpeg/src/openjpeg/src/lib/openjp2/t1_ht_generate_luts.c", + "openjpeg/src/openjpeg/src/lib/openjp2/t2.c", + "openjpeg/src/openjpeg/src/lib/openjp2/pi.c", "openjpeg/src/openjpeg/src/lib/openjp2/image.c", + "openjpeg/src/openjpeg/src/lib/openjp2/opj_malloc.c", "openjpeg/src/openjpeg/src/lib/openjp2/tcd.c", - "openjpeg/src/openjpeg/src/lib/openjp2/opj_clock.c", - "openjpeg/src/openjpeg/src/lib/openjp2/tpix_manager.c", - "openjpeg/src/openjpeg/src/lib/openjp2/mqc.c", - "openjpeg/src/openjpeg/src/lib/openjp2/openjpeg.c", + "openjpeg/src/openjpeg/src/lib/openjp2/event.c", + "openjpeg/src/openjpeg/src/lib/openjp2/cidx_manager.c", + "openjpeg/src/openjpeg/src/lib/openjp2/mct.c", "openjpeg/src/openjpeg/src/lib/openjp2/thix_manager.c", + "openjpeg/src/openjpeg/src/lib/openjp2/bio.c", "openjpeg/src/openjpeg/src/lib/openjp2/invert.c", - "openjpeg/src/openjpeg/src/lib/openjp2/cio.c", - "openjpeg/src/openjpeg/src/lib/openjp2/cidx_manager.c" + "openjpeg/src/openjpeg/src/lib/openjp2/jp2.c", + "openjpeg/src/openjpeg/src/lib/openjp2/phix_manager.c", + "openjpeg/src/openjpeg/src/lib/openjp2/j2k.c", + "openjpeg/src/openjpeg/src/lib/openjp2/tpix_manager.c", + "openjpeg/src/openjpeg/src/lib/openjp2/ppix_manager.c", + "openjpeg/src/openjpeg/src/lib/openjp2/ht_dec.c", + "openjpeg/src/openjpeg/src/lib/openjp2/t1.c", + "openjpeg/src/openjpeg/src/lib/openjp2/function_list.c", + "openjpeg/src/openjpeg/src/lib/openjp2/dwt.c", + "openjpeg/src/openjpeg/src/lib/openjp2/t1_generate_luts.c", + "openjpeg/src/openjpeg/src/lib/openjp2/opj_clock.c" ] }, "module_name": "_openjpeg" @@ -1548,7 +1550,7 @@ static const char *__pyx_f[] = { /* #### Code section: numeric_typedefs ### */ -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":731 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":730 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -1557,7 +1559,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":732 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":731 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -1566,7 +1568,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":733 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":732 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -1575,7 +1577,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":734 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":733 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -1584,7 +1586,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":738 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":737 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -1593,7 +1595,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":739 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":738 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -1602,7 +1604,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":740 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":739 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -1611,7 +1613,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":741 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":740 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -1620,7 +1622,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":745 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":744 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -1629,7 +1631,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":746 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":745 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1638,61 +1640,43 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":755 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":754 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t + * */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":756 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":755 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t - * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< - * ctypedef npy_longlong longlong_t - * - */ -typedef npy_longlong __pyx_t_5numpy_long_t; - -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":757 - * ctypedef npy_long int_t - * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":759 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":757 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t + * */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":760 - * - * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< - * ctypedef npy_ulonglong ulonglong_t +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":758 * - */ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; - -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":761 * ctypedef npy_ulong uint_t - * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":763 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":760 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1701,7 +1685,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":764 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":761 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1710,7 +1694,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":766 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":763 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1719,7 +1703,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":767 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":764 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1728,7 +1712,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":768 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":765 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1765,7 +1749,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do /*--- Type declarations ---*/ -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":770 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":767 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1774,7 +1758,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":771 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":768 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1783,7 +1767,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":772 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":769 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1792,7 +1776,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":774 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":771 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1801,8 +1785,12 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; struct __pyx_t_9_openjpeg_JPEG2000Parameters; +struct __pyx_defaults; +typedef struct __pyx_defaults __pyx_defaults; +struct __pyx_defaults1; +typedef struct __pyx_defaults1 __pyx_defaults1; -/* "_openjpeg.pyx":11 +/* "_openjpeg.pyx":12 * cimport numpy as np * * cdef extern struct JPEG2000Parameters: # <<<<<<<<<<<<<< @@ -1818,6 +1806,12 @@ struct __pyx_t_9_openjpeg_JPEG2000Parameters { unsigned int is_signed; uint32_t nr_tiles; }; +struct __pyx_defaults { + PyObject *__pyx_arg_codec; +}; +struct __pyx_defaults1 { + PyObject *__pyx_arg_codec; +}; /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ @@ -2074,6 +2068,12 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -2187,27 +2187,8 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectFormatSimple.proto */ #if CYTHON_COMPILING_IN_PYPY @@ -2231,12 +2212,31 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject_Format(s, f)) #endif +/* GetItemInt.proto */ +#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ + (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ + __Pyx_GetItemInt_Generic(o, to_py_func(i)))) +#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ + (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ + __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ + (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + /* RaiseUnboundLocalError.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* TypeImport.proto */ #ifndef __PYX_HAVE_RT_ImportType_proto_3_0_7 #define __PYX_HAVE_RT_ImportType_proto_3_0_7 @@ -2416,6 +2416,9 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, PyObject *module, PyObject *globals, PyObject* code); +/* RaiseUnexpectedTypeError.proto */ +static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -2643,8 +2646,8 @@ int __pyx_module_is_main__openjpeg = 0; /* Implementation of "_openjpeg" */ /* #### Code section: global_var ### */ -static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_ImportError; /* #### Code section: string_decls ### */ static const char __pyx_k__3[] = ": "; @@ -2653,12 +2656,16 @@ static const char __pyx_k__5[] = "*"; static const char __pyx_k_fp[] = "fp"; static const char __pyx_k_np[] = "np"; static const char __pyx_k_YUV[] = "YUV"; -static const char __pyx_k__13[] = "?"; -static const char __pyx_k_arr[] = "arr"; +static const char __pyx_k__12[] = "?"; static const char __pyx_k_bpp[] = "bpp"; +static const char __pyx_k_get[] = "get"; +static const char __pyx_k_int[] = "int"; static const char __pyx_k_msg[] = "msg"; +static const char __pyx_k_out[] = "out"; static const char __pyx_k_ptr[] = "ptr"; static const char __pyx_k_CYMK[] = "CYMK"; +static const char __pyx_k_Dict[] = "Dict"; +static const char __pyx_k_bool[] = "bool"; static const char __pyx_k_ceil[] = "ceil"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_math[] = "math"; @@ -2668,6 +2675,8 @@ static const char __pyx_k_rows[] = "rows"; static const char __pyx_k_sRGB[] = "sRGB"; static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_Union[] = "Union"; +static const char __pyx_k_bytes[] = "bytes"; static const char __pyx_k_codec[] = "codec"; static const char __pyx_k_dtype[] = "dtype"; static const char __pyx_k_e_YCC[] = "e-YCC"; @@ -2680,12 +2689,16 @@ static const char __pyx_k_ERRORS[] = "ERRORS"; static const char __pyx_k_decode[] = "decode"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_result[] = "result"; +static const char __pyx_k_return[] = "return"; +static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_colours[] = "colours"; static const char __pyx_k_columns[] = "columns"; static const char __pyx_k_p_param[] = "p_param"; static const char __pyx_k_unknown[] = "unknown"; static const char __pyx_k_version[] = "version"; +static const char __pyx_k_BinaryIO[] = "BinaryIO"; static const char __pyx_k_KeyError[] = "KeyError"; +static const char __pyx_k_as_array[] = "as_array"; static const char __pyx_k_nr_bytes[] = "nr_bytes"; static const char __pyx_k_nr_tiles[] = "nr_tiles"; static const char __pyx_k_openjpeg[] = "_openjpeg"; @@ -2707,8 +2720,11 @@ static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_failed_to_decode_image[] = "failed to decode image"; static const char __pyx_k_openjpeg__openjpeg_pyx[] = "openjpeg/_openjpeg.pyx"; static const char __pyx_k_failed_to_read_the_header[] = "failed to read the header"; -static const char __pyx_k_Error_decoding_the_J2K_data[] = "Error decoding the J2K data"; +static const char __pyx_k_Union_np_ndarray_bytearray[] = "Union[np.ndarray, bytearray]"; +static const char __pyx_k_Dict_str_Union_str_int_bool[] = "Dict[str, Union[str, int, bool]]"; +static const char __pyx_k_Error_decoding_the_J2K_data[] = "Error decoding the J2K data: "; static const char __pyx_k_failed_to_setup_the_decoder[] = "failed to setup the decoder"; +static const char __pyx_k_Error_decoding_the_J2K_data_2[] = "Error decoding the J2K data"; static const char __pyx_k_failed_to_set_the_decoded_area[] = "failed to set the decoded area"; static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import"; static const char __pyx_k_failed_to_create_the_input_strea[] = "failed to create the input stream"; @@ -2718,7 +2734,9 @@ static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath static const char __pyx_k_support_for_more_than_16_bits_pe[] = "support for more than 16-bits per component is not implemented"; /* #### Code section: decls ### */ static PyObject *__pyx_pf_9_openjpeg_get_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fp, PyObject *__pyx_v_codec); /* proto */ +static PyObject *__pyx_pf_9_openjpeg_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fp, PyObject *__pyx_v_codec, PyObject *__pyx_v_as_array); /* proto */ +static PyObject *__pyx_pf_9_openjpeg_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fp, PyObject *__pyx_v_codec); /* proto */ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ @@ -2785,20 +2803,28 @@ typedef struct { PyTypeObject *__pyx_ptype_5numpy_ufunc; #if CYTHON_USE_MODULE_STATE #endif + PyObject *__pyx_n_s_BinaryIO; PyObject *__pyx_n_u_CYMK; + PyObject *__pyx_n_s_Dict; + PyObject *__pyx_kp_s_Dict_str_Union_str_int_bool; PyObject *__pyx_n_s_ERRORS; PyObject *__pyx_kp_u_Error_decoding_the_J2K_data; + PyObject *__pyx_kp_u_Error_decoding_the_J2K_data_2; PyObject *__pyx_n_s_ImportError; PyObject *__pyx_n_s_KeyError; PyObject *__pyx_n_s_RuntimeError; + PyObject *__pyx_n_s_Union; + PyObject *__pyx_kp_s_Union_np_ndarray_bytearray; PyObject *__pyx_n_u_YUV; - PyObject *__pyx_n_s__13; + PyObject *__pyx_n_s__12; PyObject *__pyx_kp_u__3; PyObject *__pyx_kp_u__4; PyObject *__pyx_n_s__5; - PyObject *__pyx_n_s_arr; + PyObject *__pyx_n_s_as_array; PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_bool; PyObject *__pyx_n_s_bpp; + PyObject *__pyx_n_s_bytes; PyObject *__pyx_n_s_ceil; PyObject *__pyx_n_s_cline_in_traceback; PyObject *__pyx_n_s_codec; @@ -2817,10 +2843,12 @@ typedef struct { PyObject *__pyx_kp_u_failed_to_setup_the_decoder; PyObject *__pyx_kp_u_failed_to_upscale_subsampled_com; PyObject *__pyx_n_s_fp; + PyObject *__pyx_n_s_get; PyObject *__pyx_n_s_get_parameters; PyObject *__pyx_n_s_get_version; PyObject *__pyx_n_s_import; PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_int; PyObject *__pyx_n_s_is_coroutine; PyObject *__pyx_n_u_is_signed; PyObject *__pyx_n_s_main; @@ -2837,6 +2865,7 @@ typedef struct { PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; PyObject *__pyx_n_s_openjpeg; PyObject *__pyx_kp_s_openjpeg__openjpeg_pyx; + PyObject *__pyx_n_s_out; PyObject *__pyx_n_s_p_in; PyObject *__pyx_n_s_p_out; PyObject *__pyx_n_s_p_param; @@ -2845,11 +2874,13 @@ typedef struct { PyObject *__pyx_n_u_precision; PyObject *__pyx_n_s_ptr; PyObject *__pyx_n_s_result; + PyObject *__pyx_n_s_return; PyObject *__pyx_n_u_rows; PyObject *__pyx_n_u_sRGB; PyObject *__pyx_n_s_spec; PyObject *__pyx_kp_u_support_for_more_than_16_bits_pe; PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_typing; PyObject *__pyx_n_s_uint8; PyObject *__pyx_n_u_unknown; PyObject *__pyx_n_u_unspecified; @@ -2870,10 +2901,9 @@ typedef struct { PyObject *__pyx_tuple__6; PyObject *__pyx_tuple__8; PyObject *__pyx_tuple__10; - PyObject *__pyx_tuple__11; PyObject *__pyx_codeobj__7; PyObject *__pyx_codeobj__9; - PyObject *__pyx_codeobj__12; + PyObject *__pyx_codeobj__11; } __pyx_mstate; #if CYTHON_USE_MODULE_STATE @@ -2932,20 +2962,28 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible); Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character); Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc); + Py_CLEAR(clear_module_state->__pyx_n_s_BinaryIO); Py_CLEAR(clear_module_state->__pyx_n_u_CYMK); + Py_CLEAR(clear_module_state->__pyx_n_s_Dict); + Py_CLEAR(clear_module_state->__pyx_kp_s_Dict_str_Union_str_int_bool); Py_CLEAR(clear_module_state->__pyx_n_s_ERRORS); Py_CLEAR(clear_module_state->__pyx_kp_u_Error_decoding_the_J2K_data); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_decoding_the_J2K_data_2); Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); Py_CLEAR(clear_module_state->__pyx_n_s_KeyError); Py_CLEAR(clear_module_state->__pyx_n_s_RuntimeError); + Py_CLEAR(clear_module_state->__pyx_n_s_Union); + Py_CLEAR(clear_module_state->__pyx_kp_s_Union_np_ndarray_bytearray); Py_CLEAR(clear_module_state->__pyx_n_u_YUV); - Py_CLEAR(clear_module_state->__pyx_n_s__13); + Py_CLEAR(clear_module_state->__pyx_n_s__12); Py_CLEAR(clear_module_state->__pyx_kp_u__3); Py_CLEAR(clear_module_state->__pyx_kp_u__4); Py_CLEAR(clear_module_state->__pyx_n_s__5); - Py_CLEAR(clear_module_state->__pyx_n_s_arr); + Py_CLEAR(clear_module_state->__pyx_n_s_as_array); Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_bool); Py_CLEAR(clear_module_state->__pyx_n_s_bpp); + Py_CLEAR(clear_module_state->__pyx_n_s_bytes); Py_CLEAR(clear_module_state->__pyx_n_s_ceil); Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); Py_CLEAR(clear_module_state->__pyx_n_s_codec); @@ -2964,10 +3002,12 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_u_failed_to_setup_the_decoder); Py_CLEAR(clear_module_state->__pyx_kp_u_failed_to_upscale_subsampled_com); Py_CLEAR(clear_module_state->__pyx_n_s_fp); + Py_CLEAR(clear_module_state->__pyx_n_s_get); Py_CLEAR(clear_module_state->__pyx_n_s_get_parameters); Py_CLEAR(clear_module_state->__pyx_n_s_get_version); Py_CLEAR(clear_module_state->__pyx_n_s_import); Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_int); Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); Py_CLEAR(clear_module_state->__pyx_n_u_is_signed); Py_CLEAR(clear_module_state->__pyx_n_s_main); @@ -2984,6 +3024,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_u_numpy_core_umath_failed_to_impor); Py_CLEAR(clear_module_state->__pyx_n_s_openjpeg); Py_CLEAR(clear_module_state->__pyx_kp_s_openjpeg__openjpeg_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_out); Py_CLEAR(clear_module_state->__pyx_n_s_p_in); Py_CLEAR(clear_module_state->__pyx_n_s_p_out); Py_CLEAR(clear_module_state->__pyx_n_s_p_param); @@ -2992,11 +3033,13 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_u_precision); Py_CLEAR(clear_module_state->__pyx_n_s_ptr); Py_CLEAR(clear_module_state->__pyx_n_s_result); + Py_CLEAR(clear_module_state->__pyx_n_s_return); Py_CLEAR(clear_module_state->__pyx_n_u_rows); Py_CLEAR(clear_module_state->__pyx_n_u_sRGB); Py_CLEAR(clear_module_state->__pyx_n_s_spec); Py_CLEAR(clear_module_state->__pyx_kp_u_support_for_more_than_16_bits_pe); Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_typing); Py_CLEAR(clear_module_state->__pyx_n_s_uint8); Py_CLEAR(clear_module_state->__pyx_n_u_unknown); Py_CLEAR(clear_module_state->__pyx_n_u_unspecified); @@ -3017,10 +3060,9 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_tuple__6); Py_CLEAR(clear_module_state->__pyx_tuple__8); Py_CLEAR(clear_module_state->__pyx_tuple__10); - Py_CLEAR(clear_module_state->__pyx_tuple__11); Py_CLEAR(clear_module_state->__pyx_codeobj__7); Py_CLEAR(clear_module_state->__pyx_codeobj__9); - Py_CLEAR(clear_module_state->__pyx_codeobj__12); + Py_CLEAR(clear_module_state->__pyx_codeobj__11); return 0; } #endif @@ -3057,20 +3099,28 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible); Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character); Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc); + Py_VISIT(traverse_module_state->__pyx_n_s_BinaryIO); Py_VISIT(traverse_module_state->__pyx_n_u_CYMK); + Py_VISIT(traverse_module_state->__pyx_n_s_Dict); + Py_VISIT(traverse_module_state->__pyx_kp_s_Dict_str_Union_str_int_bool); Py_VISIT(traverse_module_state->__pyx_n_s_ERRORS); Py_VISIT(traverse_module_state->__pyx_kp_u_Error_decoding_the_J2K_data); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_decoding_the_J2K_data_2); Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); Py_VISIT(traverse_module_state->__pyx_n_s_KeyError); Py_VISIT(traverse_module_state->__pyx_n_s_RuntimeError); + Py_VISIT(traverse_module_state->__pyx_n_s_Union); + Py_VISIT(traverse_module_state->__pyx_kp_s_Union_np_ndarray_bytearray); Py_VISIT(traverse_module_state->__pyx_n_u_YUV); - Py_VISIT(traverse_module_state->__pyx_n_s__13); + Py_VISIT(traverse_module_state->__pyx_n_s__12); Py_VISIT(traverse_module_state->__pyx_kp_u__3); Py_VISIT(traverse_module_state->__pyx_kp_u__4); Py_VISIT(traverse_module_state->__pyx_n_s__5); - Py_VISIT(traverse_module_state->__pyx_n_s_arr); + Py_VISIT(traverse_module_state->__pyx_n_s_as_array); Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_bool); Py_VISIT(traverse_module_state->__pyx_n_s_bpp); + Py_VISIT(traverse_module_state->__pyx_n_s_bytes); Py_VISIT(traverse_module_state->__pyx_n_s_ceil); Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); Py_VISIT(traverse_module_state->__pyx_n_s_codec); @@ -3089,10 +3139,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_u_failed_to_setup_the_decoder); Py_VISIT(traverse_module_state->__pyx_kp_u_failed_to_upscale_subsampled_com); Py_VISIT(traverse_module_state->__pyx_n_s_fp); + Py_VISIT(traverse_module_state->__pyx_n_s_get); Py_VISIT(traverse_module_state->__pyx_n_s_get_parameters); Py_VISIT(traverse_module_state->__pyx_n_s_get_version); Py_VISIT(traverse_module_state->__pyx_n_s_import); Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_int); Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); Py_VISIT(traverse_module_state->__pyx_n_u_is_signed); Py_VISIT(traverse_module_state->__pyx_n_s_main); @@ -3109,6 +3161,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_u_numpy_core_umath_failed_to_impor); Py_VISIT(traverse_module_state->__pyx_n_s_openjpeg); Py_VISIT(traverse_module_state->__pyx_kp_s_openjpeg__openjpeg_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_out); Py_VISIT(traverse_module_state->__pyx_n_s_p_in); Py_VISIT(traverse_module_state->__pyx_n_s_p_out); Py_VISIT(traverse_module_state->__pyx_n_s_p_param); @@ -3117,11 +3170,13 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_u_precision); Py_VISIT(traverse_module_state->__pyx_n_s_ptr); Py_VISIT(traverse_module_state->__pyx_n_s_result); + Py_VISIT(traverse_module_state->__pyx_n_s_return); Py_VISIT(traverse_module_state->__pyx_n_u_rows); Py_VISIT(traverse_module_state->__pyx_n_u_sRGB); Py_VISIT(traverse_module_state->__pyx_n_s_spec); Py_VISIT(traverse_module_state->__pyx_kp_u_support_for_more_than_16_bits_pe); Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_typing); Py_VISIT(traverse_module_state->__pyx_n_s_uint8); Py_VISIT(traverse_module_state->__pyx_n_u_unknown); Py_VISIT(traverse_module_state->__pyx_n_u_unspecified); @@ -3142,10 +3197,9 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_tuple__6); Py_VISIT(traverse_module_state->__pyx_tuple__8); Py_VISIT(traverse_module_state->__pyx_tuple__10); - Py_VISIT(traverse_module_state->__pyx_tuple__11); Py_VISIT(traverse_module_state->__pyx_codeobj__7); Py_VISIT(traverse_module_state->__pyx_codeobj__9); - Py_VISIT(traverse_module_state->__pyx_codeobj__12); + Py_VISIT(traverse_module_state->__pyx_codeobj__11); return 0; } #endif @@ -3212,20 +3266,28 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc #if CYTHON_USE_MODULE_STATE #endif +#define __pyx_n_s_BinaryIO __pyx_mstate_global->__pyx_n_s_BinaryIO #define __pyx_n_u_CYMK __pyx_mstate_global->__pyx_n_u_CYMK +#define __pyx_n_s_Dict __pyx_mstate_global->__pyx_n_s_Dict +#define __pyx_kp_s_Dict_str_Union_str_int_bool __pyx_mstate_global->__pyx_kp_s_Dict_str_Union_str_int_bool #define __pyx_n_s_ERRORS __pyx_mstate_global->__pyx_n_s_ERRORS #define __pyx_kp_u_Error_decoding_the_J2K_data __pyx_mstate_global->__pyx_kp_u_Error_decoding_the_J2K_data +#define __pyx_kp_u_Error_decoding_the_J2K_data_2 __pyx_mstate_global->__pyx_kp_u_Error_decoding_the_J2K_data_2 #define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError #define __pyx_n_s_KeyError __pyx_mstate_global->__pyx_n_s_KeyError #define __pyx_n_s_RuntimeError __pyx_mstate_global->__pyx_n_s_RuntimeError +#define __pyx_n_s_Union __pyx_mstate_global->__pyx_n_s_Union +#define __pyx_kp_s_Union_np_ndarray_bytearray __pyx_mstate_global->__pyx_kp_s_Union_np_ndarray_bytearray #define __pyx_n_u_YUV __pyx_mstate_global->__pyx_n_u_YUV -#define __pyx_n_s__13 __pyx_mstate_global->__pyx_n_s__13 +#define __pyx_n_s__12 __pyx_mstate_global->__pyx_n_s__12 #define __pyx_kp_u__3 __pyx_mstate_global->__pyx_kp_u__3 #define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4 #define __pyx_n_s__5 __pyx_mstate_global->__pyx_n_s__5 -#define __pyx_n_s_arr __pyx_mstate_global->__pyx_n_s_arr +#define __pyx_n_s_as_array __pyx_mstate_global->__pyx_n_s_as_array #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_bool __pyx_mstate_global->__pyx_n_s_bool #define __pyx_n_s_bpp __pyx_mstate_global->__pyx_n_s_bpp +#define __pyx_n_s_bytes __pyx_mstate_global->__pyx_n_s_bytes #define __pyx_n_s_ceil __pyx_mstate_global->__pyx_n_s_ceil #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback #define __pyx_n_s_codec __pyx_mstate_global->__pyx_n_s_codec @@ -3244,10 +3306,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_u_failed_to_setup_the_decoder __pyx_mstate_global->__pyx_kp_u_failed_to_setup_the_decoder #define __pyx_kp_u_failed_to_upscale_subsampled_com __pyx_mstate_global->__pyx_kp_u_failed_to_upscale_subsampled_com #define __pyx_n_s_fp __pyx_mstate_global->__pyx_n_s_fp +#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get #define __pyx_n_s_get_parameters __pyx_mstate_global->__pyx_n_s_get_parameters #define __pyx_n_s_get_version __pyx_mstate_global->__pyx_n_s_get_version #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_int __pyx_mstate_global->__pyx_n_s_int #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine #define __pyx_n_u_is_signed __pyx_mstate_global->__pyx_n_u_is_signed #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main @@ -3264,6 +3328,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_u_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_u_numpy_core_umath_failed_to_impor #define __pyx_n_s_openjpeg __pyx_mstate_global->__pyx_n_s_openjpeg #define __pyx_kp_s_openjpeg__openjpeg_pyx __pyx_mstate_global->__pyx_kp_s_openjpeg__openjpeg_pyx +#define __pyx_n_s_out __pyx_mstate_global->__pyx_n_s_out #define __pyx_n_s_p_in __pyx_mstate_global->__pyx_n_s_p_in #define __pyx_n_s_p_out __pyx_mstate_global->__pyx_n_s_p_out #define __pyx_n_s_p_param __pyx_mstate_global->__pyx_n_s_p_param @@ -3272,11 +3337,13 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_u_precision __pyx_mstate_global->__pyx_n_u_precision #define __pyx_n_s_ptr __pyx_mstate_global->__pyx_n_s_ptr #define __pyx_n_s_result __pyx_mstate_global->__pyx_n_s_result +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return #define __pyx_n_u_rows __pyx_mstate_global->__pyx_n_u_rows #define __pyx_n_u_sRGB __pyx_mstate_global->__pyx_n_u_sRGB #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec #define __pyx_kp_u_support_for_more_than_16_bits_pe __pyx_mstate_global->__pyx_kp_u_support_for_more_than_16_bits_pe #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_typing __pyx_mstate_global->__pyx_n_s_typing #define __pyx_n_s_uint8 __pyx_mstate_global->__pyx_n_s_uint8 #define __pyx_n_u_unknown __pyx_mstate_global->__pyx_n_u_unknown #define __pyx_n_u_unspecified __pyx_mstate_global->__pyx_n_u_unspecified @@ -3297,13 +3364,12 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 #define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8 #define __pyx_tuple__10 __pyx_mstate_global->__pyx_tuple__10 -#define __pyx_tuple__11 __pyx_mstate_global->__pyx_tuple__11 #define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 #define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9 -#define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12 +#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 /* #### Code section: module_code ### */ -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":245 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":245 * * @property * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< @@ -3314,7 +3380,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self) { PyObject *__pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":248 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":248 * """Returns a borrowed reference to the object owning the data/memory. * """ * return PyArray_BASE(self) # <<<<<<<<<<<<<< @@ -3324,7 +3390,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject __pyx_r = PyArray_BASE(__pyx_v_self); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":245 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":245 * * @property * cdef inline PyObject* base(self) nogil: # <<<<<<<<<<<<<< @@ -3337,7 +3403,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":251 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":251 * * @property * cdef inline dtype descr(self): # <<<<<<<<<<<<<< @@ -3351,7 +3417,7 @@ static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArray PyArray_Descr *__pyx_t_1; __Pyx_RefNannySetupContext("descr", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":254 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":254 * """Returns an owned reference to the dtype of the array. * """ * return PyArray_DESCR(self) # <<<<<<<<<<<<<< @@ -3364,7 +3430,7 @@ static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArray __pyx_r = ((PyArray_Descr *)__pyx_t_1); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":251 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":251 * * @property * cdef inline dtype descr(self): # <<<<<<<<<<<<<< @@ -3379,7 +3445,7 @@ static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArray return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":257 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":257 * * @property * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< @@ -3390,7 +3456,7 @@ static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArray static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self) { int __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":260 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":260 * """Returns the number of dimensions in the array. * """ * return PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -3400,7 +3466,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx __pyx_r = PyArray_NDIM(__pyx_v_self); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":257 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":257 * * @property * cdef inline int ndim(self) nogil: # <<<<<<<<<<<<<< @@ -3413,7 +3479,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":263 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":263 * * @property * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< @@ -3424,7 +3490,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self) { npy_intp *__pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":268 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":268 * Can return NULL for 0-dimensional arrays. * """ * return PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -3434,7 +3500,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObjec __pyx_r = PyArray_DIMS(__pyx_v_self); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":263 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":263 * * @property * cdef inline npy_intp *shape(self) nogil: # <<<<<<<<<<<<<< @@ -3447,7 +3513,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObjec return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":271 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":271 * * @property * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< @@ -3458,7 +3524,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObjec static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self) { npy_intp *__pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":275 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":275 * The number of elements matches the number of dimensions of the array (ndim). * """ * return PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -3468,7 +3534,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayO __pyx_r = PyArray_STRIDES(__pyx_v_self); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":271 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":271 * * @property * cdef inline npy_intp *strides(self) nogil: # <<<<<<<<<<<<<< @@ -3481,7 +3547,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayO return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":278 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":278 * * @property * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< @@ -3492,7 +3558,7 @@ static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayO static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self) { npy_intp __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":281 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":281 * """Returns the total size (in number of elements) of the array. * """ * return PyArray_SIZE(self) # <<<<<<<<<<<<<< @@ -3502,7 +3568,7 @@ static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject * __pyx_r = PyArray_SIZE(__pyx_v_self); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":278 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":278 * * @property * cdef inline npy_intp size(self) nogil: # <<<<<<<<<<<<<< @@ -3515,7 +3581,7 @@ static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject * return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":284 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":284 * * @property * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< @@ -3526,7 +3592,7 @@ static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject * static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self) { char *__pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":290 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":290 * of `PyArray_DATA()` instead, which returns a 'void*'. * """ * return PyArray_BYTES(self) # <<<<<<<<<<<<<< @@ -3536,7 +3602,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__p __pyx_r = PyArray_BYTES(__pyx_v_self); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":284 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":284 * * @property * cdef inline char* data(self) nogil: # <<<<<<<<<<<<<< @@ -3549,7 +3615,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__p return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":776 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":773 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3566,7 +3632,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":777 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":774 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3574,13 +3640,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":776 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":773 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3599,7 +3665,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":779 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":776 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3616,7 +3682,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":780 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":777 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3624,13 +3690,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":779 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":776 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3649,7 +3715,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":782 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":779 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3666,7 +3732,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":783 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":780 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3674,13 +3740,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":782 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":779 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3699,7 +3765,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":785 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":782 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3716,7 +3782,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":786 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":783 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3724,13 +3790,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 786, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":785 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":782 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3749,7 +3815,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":788 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":785 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3766,7 +3832,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":789 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":786 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3774,13 +3840,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":788 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":785 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3799,7 +3865,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":791 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":788 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -3813,7 +3879,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":792 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":789 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -3823,7 +3889,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_t_1 = PyDataType_HASSUBARRAY(__pyx_v_d); if (__pyx_t_1) { - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":793 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":790 * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< @@ -3835,7 +3901,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":792 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":789 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -3844,7 +3910,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ } - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":795 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":792 * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< @@ -3858,7 +3924,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ goto __pyx_L0; } - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":791 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":788 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -3873,7 +3939,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":970 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":968 * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3882,8 +3948,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":971 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":969 * * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< @@ -3892,16 +3962,16 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":972 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":970 * cdef inline void set_array_base(ndarray arr, object base): * Py_INCREF(base) # important to do this before stealing the reference below! * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ - (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); + __pyx_t_1 = PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 970, __pyx_L1_error) - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":970 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":968 * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3910,9 +3980,13 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("numpy.set_array_base", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":974 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":972 * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3927,7 +4001,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":975 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":973 * * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< @@ -3936,7 +4010,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":976 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":974 * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< @@ -3946,7 +4020,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_base == NULL); if (__pyx_t_1) { - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":977 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":975 * base = PyArray_BASE(arr) * if base is NULL: * return None # <<<<<<<<<<<<<< @@ -3957,7 +4031,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":976 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":974 * cdef inline object get_array_base(ndarray arr): * base = PyArray_BASE(arr) * if base is NULL: # <<<<<<<<<<<<<< @@ -3966,7 +4040,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py */ } - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":978 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":976 * if base is NULL: * return None * return base # <<<<<<<<<<<<<< @@ -3978,7 +4052,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = ((PyObject *)__pyx_v_base); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":974 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":972 * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3993,7 +4067,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":982 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":980 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -4017,7 +4091,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("import_array", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":983 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":981 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -4033,16 +4107,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":984 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":982 * cdef inline int import_array() except -1: * try: * __pyx_import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 984, __pyx_L3_error) + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 982, __pyx_L3_error) - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":983 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":981 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -4056,7 +4130,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":985 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":983 * try: * __pyx_import_array() * except Exception: # <<<<<<<<<<<<<< @@ -4066,27 +4140,27 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 985, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 983, __pyx_L5_except_error) __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":986 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":984 * __pyx_import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 986, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 984, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 986, __pyx_L5_except_error) + __PYX_ERR(1, 984, __pyx_L5_except_error) } goto __pyx_L5_except_error; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":983 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":981 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -4102,7 +4176,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_L8_try_end:; } - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":982 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":980 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -4125,7 +4199,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":988 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":986 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -4149,7 +4223,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("import_umath", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":989 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":987 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -4165,16 +4239,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":990 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":988 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 990, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 988, __pyx_L3_error) - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":989 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":987 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -4188,7 +4262,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":991 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":989 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -4198,27 +4272,27 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 991, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 989, __pyx_L5_except_error) __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":992 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":990 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 992, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 990, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 992, __pyx_L5_except_error) + __PYX_ERR(1, 990, __pyx_L5_except_error) } goto __pyx_L5_except_error; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":989 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":987 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -4234,7 +4308,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_L8_try_end:; } - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":988 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":986 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -4257,7 +4331,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":994 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":992 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -4281,7 +4355,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { int __pyx_clineno = 0; __Pyx_RefNannySetupContext("import_ufunc", 1); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":995 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":993 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -4297,16 +4371,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":996 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":994 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 996, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 994, __pyx_L3_error) - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":995 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":993 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -4320,7 +4394,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":997 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":995 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -4330,27 +4404,27 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 997, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 995, __pyx_L5_except_error) __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":998 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":996 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 998, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 996, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 998, __pyx_L5_except_error) + __PYX_ERR(1, 996, __pyx_L5_except_error) } goto __pyx_L5_except_error; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":995 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":993 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -4366,7 +4440,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_L8_try_end:; } - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":994 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":992 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -4389,7 +4463,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1001 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":999 * * * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< @@ -4400,7 +4474,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) { int __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1013 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1011 * bool * """ * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<< @@ -4410,7 +4484,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_ __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type)); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1001 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":999 * * * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<< @@ -4423,7 +4497,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_ return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1016 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1014 * * * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< @@ -4434,7 +4508,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) { int __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1028 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1026 * bool * """ * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<< @@ -4444,7 +4518,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type)); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1016 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1014 * * * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<< @@ -4457,7 +4531,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1031 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1029 * * * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -4468,7 +4542,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_o static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) { npy_datetime __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1038 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1036 * also needed. That can be found using `get_datetime64_unit`. * """ * return (obj).obval # <<<<<<<<<<<<<< @@ -4478,7 +4552,7 @@ static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject * __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1031 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1029 * * * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -4491,7 +4565,7 @@ static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject * return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1041 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1039 * * * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -4502,7 +4576,7 @@ static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject * static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) { npy_timedelta __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1045 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1043 * returns the int64 value underlying scalar numpy timedelta64 object * """ * return (obj).obval # <<<<<<<<<<<<<< @@ -4512,7 +4586,7 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval; goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1041 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1039 * * * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<< @@ -4525,7 +4599,7 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject return __pyx_r; } -/* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1048 +/* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1046 * * * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< @@ -4536,7 +4610,7 @@ static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) { NPY_DATETIMEUNIT __pyx_r; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1052 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1050 * returns the unit part of the dtype for a numpy datetime64 object. * """ * return (obj).obmeta.base # <<<<<<<<<<<<<< @@ -4544,7 +4618,7 @@ static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObjec __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base); goto __pyx_L0; - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":1048 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":1046 * * * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<< @@ -4557,10 +4631,10 @@ static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObjec return __pyx_r; } -/* "_openjpeg.pyx":37 +/* "_openjpeg.pyx":38 * * - * def get_version(): # <<<<<<<<<<<<<< + * def get_version() -> bytes: # <<<<<<<<<<<<<< * """Return the openjpeg version as bytes.""" * cdef char *version = OpenJpegVersion() */ @@ -4592,8 +4666,8 @@ static PyObject *__pyx_pf_9_openjpeg_get_version(CYTHON_UNUSED PyObject *__pyx_s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_version", 1); - /* "_openjpeg.pyx":39 - * def get_version(): + /* "_openjpeg.pyx":40 + * def get_version() -> bytes: * """Return the openjpeg version as bytes.""" * cdef char *version = OpenJpegVersion() # <<<<<<<<<<<<<< * @@ -4601,7 +4675,7 @@ static PyObject *__pyx_pf_9_openjpeg_get_version(CYTHON_UNUSED PyObject *__pyx_s */ __pyx_v_version = OpenJpegVersion(); - /* "_openjpeg.pyx":41 + /* "_openjpeg.pyx":42 * cdef char *version = OpenJpegVersion() * * return version # <<<<<<<<<<<<<< @@ -4609,16 +4683,16 @@ static PyObject *__pyx_pf_9_openjpeg_get_version(CYTHON_UNUSED PyObject *__pyx_s * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "_openjpeg.pyx":37 + /* "_openjpeg.pyx":38 * * - * def get_version(): # <<<<<<<<<<<<<< + * def get_version() -> bytes: # <<<<<<<<<<<<<< * """Return the openjpeg version as bytes.""" * cdef char *version = OpenJpegVersion() */ @@ -4634,13 +4708,71 @@ static PyObject *__pyx_pf_9_openjpeg_get_version(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "_openjpeg.pyx":44 +/* "_openjpeg.pyx":45 * * - * def decode(fp, codec=0): # <<<<<<<<<<<<<< + * def decode( # <<<<<<<<<<<<<< + * fp: BinaryIO, + * codec: int = 0, + */ + +static PyObject *__pyx_pf_9_openjpeg_6__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__defaults__", 1); + __Pyx_XDECREF(__pyx_r); + + /* "_openjpeg.pyx":48 + * fp: BinaryIO, + * codec: int = 0, + * as_array: bool = False # <<<<<<<<<<<<<< + * ) -> Union[np.ndarray, bytearray]: * """Return the decoded JPEG 2000 data from Python file-like `fp`. + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_codec); + __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_codec); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_codec)) __PYX_ERR(0, 45, __pyx_L1_error); + __Pyx_INCREF(((PyObject *)Py_False)); + __Pyx_GIVEREF(((PyObject *)Py_False)); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)Py_False))) __PYX_ERR(0, 45, __pyx_L1_error); + + /* "_openjpeg.pyx":45 + * * + * def decode( # <<<<<<<<<<<<<< + * fp: BinaryIO, + * codec: int = 0, */ + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(0, 45, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_openjpeg.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} /* Python wrapper */ static PyObject *__pyx_pw_9_openjpeg_3decode(PyObject *__pyx_self, @@ -4650,7 +4782,7 @@ PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ -PyDoc_STRVAR(__pyx_doc_9_openjpeg_2decode, "Return the decoded JPEG 2000 data from Python file-like `fp`.\n\n Parameters\n ----------\n fp : file-like\n A Python file-like containing the encoded JPEG 2000 data. Must have\n ``tell()``, ``seek()`` and ``read()`` methods.\n codec : int, optional\n The codec to use for decoding, one of:\n\n * ``0``: JPEG-2000 codestream\n * ``1``: JPT-stream (JPEG 2000, JPIP)\n * ``2``: JP2 file format\n\n Returns\n -------\n numpy.ndarray\n An ndarray of uint8 containing the decoded image data.\n\n Raises\n ------\n RuntimeError\n If unable to decode the JPEG 2000 data.\n "); +PyDoc_STRVAR(__pyx_doc_9_openjpeg_2decode, "Return the decoded JPEG 2000 data from Python file-like `fp`.\n\n Parameters\n ----------\n fp : file-like\n A Python file-like containing the encoded JPEG 2000 data. Must have\n ``tell()``, ``seek()`` and ``read()`` methods.\n codec : int, optional\n The codec to use for decoding, one of:\n\n * ``0``: JPEG-2000 codestream\n * ``1``: JPT-stream (JPEG 2000, JPIP)\n * ``2``: JP2 file format\n as_array : bool, optional\n If ``True`` then return the decoded image data as a :class:`numpy.ndarray`\n otherwise return the data as a :class:`bytearray` (default).\n\n Returns\n -------\n bytearray | numpy.ndarray\n If `as_array` is False (default) then returns the decoded image data\n as a :class:`bytearray`, otherwise returns the image data as a\n :class:`numpy.ndarray`.\n\n Raises\n ------\n RuntimeError\n If unable to decode the JPEG 2000 data.\n "); static PyMethodDef __pyx_mdef_9_openjpeg_3decode = {"decode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9_openjpeg_3decode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9_openjpeg_2decode}; static PyObject *__pyx_pw_9_openjpeg_3decode(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL @@ -4661,11 +4793,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds ) { PyObject *__pyx_v_fp = 0; PyObject *__pyx_v_codec = 0; + PyObject *__pyx_v_as_array = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[2] = {0,0}; + PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4681,11 +4814,15 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fp,&__pyx_n_s_codec,0}; - values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0))); + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fp,&__pyx_n_s_codec,&__pyx_n_s_as_array,0}; + __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self); + values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_codec); + values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False))); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); @@ -4700,22 +4837,31 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_codec); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_as_array); + if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "decode") < 0)) __PYX_ERR(0, 44, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "decode") < 0)) __PYX_ERR(0, 45, __pyx_L3_error) } } else { switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); @@ -4724,11 +4870,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } __pyx_v_fp = values[0]; - __pyx_v_codec = values[1]; + __pyx_v_codec = ((PyObject*)values[1]); + __pyx_v_as_array = values[2]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 44, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -4742,9 +4889,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_9_openjpeg_2decode(__pyx_self, __pyx_v_fp, __pyx_v_codec); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_codec), (&PyInt_Type), 0, "codec", 1))) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_r = __pyx_pf_9_openjpeg_2decode(__pyx_self, __pyx_v_fp, __pyx_v_codec, __pyx_v_as_array); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -4755,15 +4907,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fp, PyObject *__pyx_v_codec) { +static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fp, PyObject *__pyx_v_codec, PyObject *__pyx_v_as_array) { PyObject *__pyx_v_param = NULL; PyObject *__pyx_v_bpp = NULL; PyObject *__pyx_v_nr_bytes = NULL; PyObject *__pyx_v_p_in; - PyObject *__pyx_v_arr = NULL; unsigned char *__pyx_v_p_out; + PyObject *__pyx_v_out = NULL; int __pyx_v_result; - PyObject *__pyx_v_msg = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4771,24 +4922,22 @@ static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + unsigned char *__pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode", 1); - /* "_openjpeg.pyx":69 + /* "_openjpeg.pyx":79 * If unable to decode the JPEG 2000 data. * """ * param = get_parameters(fp, codec) # <<<<<<<<<<<<<< * bpp = ceil(param['precision'] / 8) * nr_bytes = param['rows'] * param['columns'] * param['nr_components'] * bpp */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_parameters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_parameters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -4808,25 +4957,25 @@ static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_fp, __pyx_v_codec}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_param = __pyx_t_1; __pyx_t_1 = 0; - /* "_openjpeg.pyx":70 + /* "_openjpeg.pyx":80 * """ * param = get_parameters(fp, codec) * bpp = ceil(param['precision'] / 8) # <<<<<<<<<<<<<< * nr_bytes = param['rows'] * param['columns'] * param['nr_components'] * bpp * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ceil); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ceil); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_3, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_TrueDivideObjC(__pyx_t_3, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -4848,248 +4997,246 @@ static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_v_bpp = __pyx_t_1; __pyx_t_1 = 0; - /* "_openjpeg.pyx":71 + /* "_openjpeg.pyx":81 * param = get_parameters(fp, codec) * bpp = ceil(param['precision'] / 8) * nr_bytes = param['rows'] * param['columns'] * param['nr_components'] * bpp # <<<<<<<<<<<<<< * * cdef PyObject* p_in = fp */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_rows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_rows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_columns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_columns); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_nr_components); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_param, __pyx_n_u_nr_components); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_bpp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_bpp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_nr_bytes = __pyx_t_2; __pyx_t_2 = 0; - /* "_openjpeg.pyx":73 + /* "_openjpeg.pyx":83 * nr_bytes = param['rows'] * param['columns'] * param['nr_components'] * bpp * * cdef PyObject* p_in = fp # <<<<<<<<<<<<<< - * arr = np.zeros(nr_bytes, dtype=np.uint8) - * cdef unsigned char *p_out = np.PyArray_DATA(arr) + * cdef unsigned char *p_out + * if as_array: */ __pyx_v_p_in = ((PyObject *)__pyx_v_fp); - /* "_openjpeg.pyx":74 - * + /* "_openjpeg.pyx":85 * cdef PyObject* p_in = fp - * arr = np.zeros(nr_bytes, dtype=np.uint8) # <<<<<<<<<<<<<< - * cdef unsigned char *p_out = np.PyArray_DATA(arr) - * + * cdef unsigned char *p_out + * if as_array: # <<<<<<<<<<<<<< + * out = np.zeros(nr_bytes, dtype=np.uint8) + * p_out = np.PyArray_DATA(out) + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_as_array); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 85, __pyx_L1_error) + if (__pyx_t_6) { + + /* "_openjpeg.pyx":86 + * cdef unsigned char *p_out + * if as_array: + * out = np.zeros(nr_bytes, dtype=np.uint8) # <<<<<<<<<<<<<< + * p_out = np.PyArray_DATA(out) + * else: */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_nr_bytes); - __Pyx_GIVEREF(__pyx_v_nr_bytes); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_nr_bytes)) __PYX_ERR(0, 74, __pyx_L1_error); - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_arr = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_nr_bytes); + __Pyx_GIVEREF(__pyx_v_nr_bytes); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_nr_bytes)) __PYX_ERR(0, 86, __pyx_L1_error); + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_out = __pyx_t_7; + __pyx_t_7 = 0; - /* "_openjpeg.pyx":75 + /* "_openjpeg.pyx":87 + * if as_array: + * out = np.zeros(nr_bytes, dtype=np.uint8) + * p_out = np.PyArray_DATA(out) # <<<<<<<<<<<<<< + * else: + * out = bytearray(nr_bytes) + */ + if (!(likely(((__pyx_v_out) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_out, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_v_p_out = ((unsigned char *)PyArray_DATA(((PyArrayObject *)__pyx_v_out))); + + /* "_openjpeg.pyx":85 * cdef PyObject* p_in = fp - * arr = np.zeros(nr_bytes, dtype=np.uint8) - * cdef unsigned char *p_out = np.PyArray_DATA(arr) # <<<<<<<<<<<<<< + * cdef unsigned char *p_out + * if as_array: # <<<<<<<<<<<<<< + * out = np.zeros(nr_bytes, dtype=np.uint8) + * p_out = np.PyArray_DATA(out) + */ + goto __pyx_L3; + } + + /* "_openjpeg.pyx":89 + * p_out = np.PyArray_DATA(out) + * else: + * out = bytearray(nr_bytes) # <<<<<<<<<<<<<< + * p_out = out + * + */ + /*else*/ { + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_v_nr_bytes); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_v_out = __pyx_t_7; + __pyx_t_7 = 0; + + /* "_openjpeg.pyx":90 + * else: + * out = bytearray(nr_bytes) + * p_out = out # <<<<<<<<<<<<<< * * result = Decode(p_in, p_out, codec) */ - if (!(likely(((__pyx_v_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_arr, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 75, __pyx_L1_error) - __pyx_v_p_out = ((unsigned char *)PyArray_DATA(((PyArrayObject *)__pyx_v_arr))); + __pyx_t_8 = __Pyx_PyObject_AsWritableUString(__pyx_v_out); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_v_p_out = ((unsigned char *)__pyx_t_8); + } + __pyx_L3:; - /* "_openjpeg.pyx":77 - * cdef unsigned char *p_out = np.PyArray_DATA(arr) + /* "_openjpeg.pyx":92 + * p_out = out * * result = Decode(p_in, p_out, codec) # <<<<<<<<<<<<<< * if result != 0: - * try: + * raise RuntimeError( */ - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_codec); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_codec); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L1_error) __pyx_v_result = Decode(__pyx_v_p_in, __pyx_v_p_out, __pyx_t_4); - /* "_openjpeg.pyx":78 + /* "_openjpeg.pyx":93 * * result = Decode(p_in, p_out, codec) * if result != 0: # <<<<<<<<<<<<<< - * try: - * msg = f": {ERRORS[result]}" + * raise RuntimeError( + * f"Error decoding the J2K data: {ERRORS.get(result, result)}" */ - __pyx_t_7 = (__pyx_v_result != 0); - if (__pyx_t_7) { + __pyx_t_6 = (__pyx_v_result != 0); + if (unlikely(__pyx_t_6)) { - /* "_openjpeg.pyx":79 - * result = Decode(p_in, p_out, codec) + /* "_openjpeg.pyx":95 * if result != 0: - * try: # <<<<<<<<<<<<<< - * msg = f": {ERRORS[result]}" - * except KeyError: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_10); - /*try:*/ { - - /* "_openjpeg.pyx":80 - * if result != 0: - * try: - * msg = f": {ERRORS[result]}" # <<<<<<<<<<<<<< - * except KeyError: - * pass - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ERRORS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_result, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u__3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_msg = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; - - /* "_openjpeg.pyx":79 - * result = Decode(p_in, p_out, codec) - * if result != 0: - * try: # <<<<<<<<<<<<<< - * msg = f": {ERRORS[result]}" - * except KeyError: - */ - } - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "_openjpeg.pyx":81 - * try: - * msg = f": {ERRORS[result]}" - * except KeyError: # <<<<<<<<<<<<<< - * pass + * raise RuntimeError( + * f"Error decoding the J2K data: {ERRORS.get(result, result)}" # <<<<<<<<<<<<<< + * ) * */ - __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); - if (__pyx_t_4) { - __Pyx_ErrRestore(0,0,0); - goto __pyx_L5_exception_handled; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ERRORS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; } - goto __pyx_L6_except_error; + } + #endif + { + PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_5, __pyx_t_1}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_decoding_the_J2K_data, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_openjpeg.pyx":79 + /* "_openjpeg.pyx":94 * result = Decode(p_in, p_out, codec) * if result != 0: - * try: # <<<<<<<<<<<<<< - * msg = f": {ERRORS[result]}" - * except KeyError: + * raise RuntimeError( # <<<<<<<<<<<<<< + * f"Error decoding the J2K data: {ERRORS.get(result, result)}" + * ) */ - __pyx_L6_except_error:; - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); - goto __pyx_L1_error; - __pyx_L5_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); - __pyx_L9_try_end:; - } - - /* "_openjpeg.pyx":84 - * pass - * - * raise RuntimeError("Error decoding the J2K data" + msg) # <<<<<<<<<<<<<< - * - * return arr - */ - if (unlikely(!__pyx_v_msg)) { __Pyx_RaiseUnboundLocalError("msg"); __PYX_ERR(0, 84, __pyx_L1_error) } - __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_decoding_the_J2K_data, __pyx_v_msg); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_6, 0, 0, 0); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 94, __pyx_L1_error) - /* "_openjpeg.pyx":78 + /* "_openjpeg.pyx":93 * * result = Decode(p_in, p_out, codec) * if result != 0: # <<<<<<<<<<<<<< - * try: - * msg = f": {ERRORS[result]}" + * raise RuntimeError( + * f"Error decoding the J2K data: {ERRORS.get(result, result)}" */ } - /* "_openjpeg.pyx":86 - * raise RuntimeError("Error decoding the J2K data" + msg) + /* "_openjpeg.pyx":98 + * ) * - * return arr # <<<<<<<<<<<<<< + * return out # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_arr); - __pyx_r = __pyx_v_arr; + __Pyx_INCREF(__pyx_v_out); + __pyx_r = __pyx_v_out; goto __pyx_L0; - /* "_openjpeg.pyx":44 + /* "_openjpeg.pyx":45 * * - * def decode(fp, codec=0): # <<<<<<<<<<<<<< - * """Return the decoded JPEG 2000 data from Python file-like `fp`. - * + * def decode( # <<<<<<<<<<<<<< + * fp: BinaryIO, + * codec: int = 0, */ /* function exit code */ @@ -5098,28 +5245,66 @@ static PyObject *__pyx_pf_9_openjpeg_2decode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("_openjpeg.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_param); __Pyx_XDECREF(__pyx_v_bpp); __Pyx_XDECREF(__pyx_v_nr_bytes); - __Pyx_XDECREF(__pyx_v_arr); - __Pyx_XDECREF(__pyx_v_msg); + __Pyx_XDECREF(__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_openjpeg.pyx":89 +/* "_openjpeg.pyx":101 * * - * def get_parameters(fp, codec=0): # <<<<<<<<<<<<<< + * def get_parameters(fp: BinaryIO, codec: int = 0) -> Dict[str, Union[str, int, bool]]: # <<<<<<<<<<<<<< * """Return a :class:`dict` containing the JPEG 2000 image parameters. * */ +static PyObject *__pyx_pf_9_openjpeg_8__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__defaults__", 1); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_codec); + __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_codec); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self)->__pyx_arg_codec)) __PYX_ERR(0, 101, __pyx_L1_error); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None)) __PYX_ERR(0, 101, __pyx_L1_error); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_openjpeg.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* Python wrapper */ static PyObject *__pyx_pw_9_openjpeg_5get_parameters(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL @@ -5160,7 +5345,8 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fp,&__pyx_n_s_codec,0}; - values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)__pyx_int_0))); + __pyx_defaults1 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_self); + values[1] = __Pyx_Arg_NewRef_FASTCALL(__pyx_dynamic_args->__pyx_arg_codec); if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { @@ -5178,19 +5364,19 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_codec); if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_parameters") < 0)) __PYX_ERR(0, 89, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_parameters") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else { switch (__pyx_nargs) { @@ -5202,11 +5388,11 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } } __pyx_v_fp = values[0]; - __pyx_v_codec = values[1]; + __pyx_v_codec = ((PyObject*)values[1]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_parameters", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 89, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_parameters", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5220,9 +5406,14 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_codec), (&PyInt_Type), 0, "codec", 1))) __PYX_ERR(0, 101, __pyx_L1_error) __pyx_r = __pyx_pf_9_openjpeg_4get_parameters(__pyx_self, __pyx_v_fp, __pyx_v_codec); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { @@ -5257,7 +5448,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_parameters", 1); - /* "_openjpeg.pyx":118 + /* "_openjpeg.pyx":130 * """ * cdef JPEG2000Parameters param * param.columns = 0 # <<<<<<<<<<<<<< @@ -5266,7 +5457,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.columns = 0; - /* "_openjpeg.pyx":119 + /* "_openjpeg.pyx":131 * cdef JPEG2000Parameters param * param.columns = 0 * param.rows = 0 # <<<<<<<<<<<<<< @@ -5275,7 +5466,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.rows = 0; - /* "_openjpeg.pyx":120 + /* "_openjpeg.pyx":132 * param.columns = 0 * param.rows = 0 * param.colourspace = 0 # <<<<<<<<<<<<<< @@ -5284,7 +5475,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.colourspace = 0; - /* "_openjpeg.pyx":121 + /* "_openjpeg.pyx":133 * param.rows = 0 * param.colourspace = 0 * param.nr_components = 0 # <<<<<<<<<<<<<< @@ -5293,7 +5484,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.nr_components = 0; - /* "_openjpeg.pyx":122 + /* "_openjpeg.pyx":134 * param.colourspace = 0 * param.nr_components = 0 * param.precision = 0 # <<<<<<<<<<<<<< @@ -5302,7 +5493,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.precision = 0; - /* "_openjpeg.pyx":123 + /* "_openjpeg.pyx":135 * param.nr_components = 0 * param.precision = 0 * param.is_signed = 0 # <<<<<<<<<<<<<< @@ -5311,7 +5502,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.is_signed = 0; - /* "_openjpeg.pyx":124 + /* "_openjpeg.pyx":136 * param.precision = 0 * param.is_signed = 0 * param.nr_tiles = 0 # <<<<<<<<<<<<<< @@ -5320,7 +5511,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_param.nr_tiles = 0; - /* "_openjpeg.pyx":127 + /* "_openjpeg.pyx":139 * * # Pointer to the JPEGParameters object * cdef JPEG2000Parameters *p_param = ¶m # <<<<<<<<<<<<<< @@ -5329,7 +5520,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_p_param = (&__pyx_v_param); - /* "_openjpeg.pyx":130 + /* "_openjpeg.pyx":142 * * # Pointer to J2K data * cdef PyObject* ptr = fp # <<<<<<<<<<<<<< @@ -5338,17 +5529,17 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ __pyx_v_ptr = ((PyObject *)__pyx_v_fp); - /* "_openjpeg.pyx":133 + /* "_openjpeg.pyx":145 * * # Decode the data - output is written to output_buffer * result = GetParameters(ptr, codec, p_param) # <<<<<<<<<<<<<< * if result != 0: * try: */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_codec); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_codec); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) __pyx_v_result = GetParameters(__pyx_v_ptr, __pyx_t_1, __pyx_v_p_param); - /* "_openjpeg.pyx":134 + /* "_openjpeg.pyx":146 * # Decode the data - output is written to output_buffer * result = GetParameters(ptr, codec, p_param) * if result != 0: # <<<<<<<<<<<<<< @@ -5358,7 +5549,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __pyx_t_2 = (__pyx_v_result != 0); if (__pyx_t_2) { - /* "_openjpeg.pyx":135 + /* "_openjpeg.pyx":147 * result = GetParameters(ptr, codec, p_param) * if result != 0: * try: # <<<<<<<<<<<<<< @@ -5374,28 +5565,28 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "_openjpeg.pyx":136 + /* "_openjpeg.pyx":148 * if result != 0: * try: * msg = f": {ERRORS[result]}" # <<<<<<<<<<<<<< * except KeyError: * pass */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ERRORS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 136, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ERRORS); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_result, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 136, __pyx_L4_error) + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_result, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 136, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u__3, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 136, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u__3, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_msg = ((PyObject*)__pyx_t_7); __pyx_t_7 = 0; - /* "_openjpeg.pyx":135 + /* "_openjpeg.pyx":147 * result = GetParameters(ptr, codec, p_param) * if result != 0: * try: # <<<<<<<<<<<<<< @@ -5411,7 +5602,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "_openjpeg.pyx":137 + /* "_openjpeg.pyx":149 * try: * msg = f": {ERRORS[result]}" * except KeyError: # <<<<<<<<<<<<<< @@ -5425,7 +5616,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p } goto __pyx_L6_except_error; - /* "_openjpeg.pyx":135 + /* "_openjpeg.pyx":147 * result = GetParameters(ptr, codec, p_param) * if result != 0: * try: # <<<<<<<<<<<<<< @@ -5446,24 +5637,24 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __pyx_L9_try_end:; } - /* "_openjpeg.pyx":140 + /* "_openjpeg.pyx":152 * pass * * raise RuntimeError("Error decoding the J2K data" + msg) # <<<<<<<<<<<<<< * * # From openjpeg.h#L309 */ - if (unlikely(!__pyx_v_msg)) { __Pyx_RaiseUnboundLocalError("msg"); __PYX_ERR(0, 140, __pyx_L1_error) } - __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_decoding_the_J2K_data, __pyx_v_msg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __pyx_L1_error) + if (unlikely(!__pyx_v_msg)) { __Pyx_RaiseUnboundLocalError("msg"); __PYX_ERR(0, 152, __pyx_L1_error) } + __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_decoding_the_J2K_data_2, __pyx_v_msg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 140, __pyx_L1_error) + __PYX_ERR(0, 152, __pyx_L1_error) - /* "_openjpeg.pyx":134 + /* "_openjpeg.pyx":146 * # Decode the data - output is written to output_buffer * result = GetParameters(ptr, codec, p_param) * if result != 0: # <<<<<<<<<<<<<< @@ -5472,26 +5663,26 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p */ } - /* "_openjpeg.pyx":144 + /* "_openjpeg.pyx":156 * # From openjpeg.h#L309 * colours = { * -1: "unknown", # <<<<<<<<<<<<<< * 0: "unspecified", * 1: "sRGB", */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_int_neg_1, __pyx_n_u_unknown) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_int_0, __pyx_n_u_unspecified) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_int_1, __pyx_n_u_sRGB) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_int_2, __pyx_n_u_monochrome) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_int_3, __pyx_n_u_YUV) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_int_4, __pyx_kp_u_e_YCC) < 0) __PYX_ERR(0, 144, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_6, __pyx_int_5, __pyx_n_u_CYMK) < 0) __PYX_ERR(0, 144, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_neg_1, __pyx_n_u_unknown) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_0, __pyx_n_u_unspecified) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_1, __pyx_n_u_sRGB) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_2, __pyx_n_u_monochrome) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_3, __pyx_n_u_YUV) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_4, __pyx_kp_u_e_YCC) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_int_5, __pyx_n_u_CYMK) < 0) __PYX_ERR(0, 156, __pyx_L1_error) __pyx_v_colours = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "_openjpeg.pyx":153 + /* "_openjpeg.pyx":165 * } * * try: # <<<<<<<<<<<<<< @@ -5507,22 +5698,22 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "_openjpeg.pyx":154 + /* "_openjpeg.pyx":166 * * try: * colourspace = colours[param.colourspace] # <<<<<<<<<<<<<< * except KeyError: * colourspace = "unknown" */ - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_param.colourspace); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L10_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_param.colourspace); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_colours, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L10_error) + __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_colours, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 166, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_colourspace = __pyx_t_7; __pyx_t_7 = 0; - /* "_openjpeg.pyx":153 + /* "_openjpeg.pyx":165 * } * * try: # <<<<<<<<<<<<<< @@ -5538,7 +5729,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "_openjpeg.pyx":155 + /* "_openjpeg.pyx":167 * try: * colourspace = colours[param.colourspace] * except KeyError: # <<<<<<<<<<<<<< @@ -5548,12 +5739,12 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __pyx_t_1 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_1) { __Pyx_AddTraceback("_openjpeg.get_parameters", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(0, 155, __pyx_L12_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_8) < 0) __PYX_ERR(0, 167, __pyx_L12_except_error) __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_8); - /* "_openjpeg.pyx":156 + /* "_openjpeg.pyx":168 * colourspace = colours[param.colourspace] * except KeyError: * colourspace = "unknown" # <<<<<<<<<<<<<< @@ -5569,7 +5760,7 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p } goto __pyx_L12_except_error; - /* "_openjpeg.pyx":153 + /* "_openjpeg.pyx":165 * } * * try: # <<<<<<<<<<<<<< @@ -5590,96 +5781,96 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __pyx_L15_try_end:; } - /* "_openjpeg.pyx":159 + /* "_openjpeg.pyx":171 * * parameters = { * 'rows' : param.rows, # <<<<<<<<<<<<<< * 'columns' : param.columns, * 'colourspace' : colourspace, */ - __pyx_t_8 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.rows); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.rows); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_rows, __pyx_t_6) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_rows, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "_openjpeg.pyx":160 + /* "_openjpeg.pyx":172 * parameters = { * 'rows' : param.rows, * 'columns' : param.columns, # <<<<<<<<<<<<<< * 'colourspace' : colourspace, * 'nr_components' : param.nr_components, */ - __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.columns); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.columns); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_columns, __pyx_t_6) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_columns, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "_openjpeg.pyx":161 + /* "_openjpeg.pyx":173 * 'rows' : param.rows, * 'columns' : param.columns, * 'colourspace' : colourspace, # <<<<<<<<<<<<<< * 'nr_components' : param.nr_components, * 'precision' : param.precision, */ - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_colourspace, __pyx_v_colourspace) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_colourspace, __pyx_v_colourspace) < 0) __PYX_ERR(0, 171, __pyx_L1_error) - /* "_openjpeg.pyx":162 + /* "_openjpeg.pyx":174 * 'columns' : param.columns, * 'colourspace' : colourspace, * 'nr_components' : param.nr_components, # <<<<<<<<<<<<<< * 'precision' : param.precision, * 'is_signed' : bool(param.is_signed), */ - __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.nr_components); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.nr_components); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_nr_components, __pyx_t_6) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_nr_components, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "_openjpeg.pyx":163 + /* "_openjpeg.pyx":175 * 'colourspace' : colourspace, * 'nr_components' : param.nr_components, * 'precision' : param.precision, # <<<<<<<<<<<<<< * 'is_signed' : bool(param.is_signed), * 'nr_tiles' : param.nr_tiles, */ - __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.precision); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.precision); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_precision, __pyx_t_6) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_precision, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "_openjpeg.pyx":164 + /* "_openjpeg.pyx":176 * 'nr_components' : param.nr_components, * 'precision' : param.precision, * 'is_signed' : bool(param.is_signed), # <<<<<<<<<<<<<< * 'nr_tiles' : param.nr_tiles, * } */ - __pyx_t_6 = __Pyx_PyInt_From_unsigned_int(__pyx_v_param.is_signed); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_unsigned_int(__pyx_v_param.is_signed); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBool_FromLong((!(!__pyx_t_2))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_is_signed, __pyx_t_6) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_is_signed, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "_openjpeg.pyx":165 + /* "_openjpeg.pyx":177 * 'precision' : param.precision, * 'is_signed' : bool(param.is_signed), * 'nr_tiles' : param.nr_tiles, # <<<<<<<<<<<<<< * } * */ - __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.nr_tiles); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_param.nr_tiles); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_nr_tiles, __pyx_t_6) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_8, __pyx_n_u_nr_tiles, __pyx_t_6) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_parameters = ((PyObject*)__pyx_t_8); __pyx_t_8 = 0; - /* "_openjpeg.pyx":168 + /* "_openjpeg.pyx":180 * } * * return parameters # <<<<<<<<<<<<<< @@ -5689,10 +5880,10 @@ static PyObject *__pyx_pf_9_openjpeg_4get_parameters(CYTHON_UNUSED PyObject *__p __pyx_r = __pyx_v_parameters; goto __pyx_L0; - /* "_openjpeg.pyx":89 + /* "_openjpeg.pyx":101 * * - * def get_parameters(fp, codec=0): # <<<<<<<<<<<<<< + * def get_parameters(fp: BinaryIO, codec: int = 0) -> Dict[str, Union[str, int, bool]]: # <<<<<<<<<<<<<< * """Return a :class:`dict` containing the JPEG 2000 image parameters. * */ @@ -5730,20 +5921,28 @@ static PyMethodDef __pyx_methods[] = { static int __Pyx_CreateStringTabAndInitStrings(void) { __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_BinaryIO, __pyx_k_BinaryIO, sizeof(__pyx_k_BinaryIO), 0, 0, 1, 1}, {&__pyx_n_u_CYMK, __pyx_k_CYMK, sizeof(__pyx_k_CYMK), 0, 1, 0, 1}, + {&__pyx_n_s_Dict, __pyx_k_Dict, sizeof(__pyx_k_Dict), 0, 0, 1, 1}, + {&__pyx_kp_s_Dict_str_Union_str_int_bool, __pyx_k_Dict_str_Union_str_int_bool, sizeof(__pyx_k_Dict_str_Union_str_int_bool), 0, 0, 1, 0}, {&__pyx_n_s_ERRORS, __pyx_k_ERRORS, sizeof(__pyx_k_ERRORS), 0, 0, 1, 1}, {&__pyx_kp_u_Error_decoding_the_J2K_data, __pyx_k_Error_decoding_the_J2K_data, sizeof(__pyx_k_Error_decoding_the_J2K_data), 0, 1, 0, 0}, + {&__pyx_kp_u_Error_decoding_the_J2K_data_2, __pyx_k_Error_decoding_the_J2K_data_2, sizeof(__pyx_k_Error_decoding_the_J2K_data_2), 0, 1, 0, 0}, {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_Union, __pyx_k_Union, sizeof(__pyx_k_Union), 0, 0, 1, 1}, + {&__pyx_kp_s_Union_np_ndarray_bytearray, __pyx_k_Union_np_ndarray_bytearray, sizeof(__pyx_k_Union_np_ndarray_bytearray), 0, 0, 1, 0}, {&__pyx_n_u_YUV, __pyx_k_YUV, sizeof(__pyx_k_YUV), 0, 1, 0, 1}, - {&__pyx_n_s__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 1, 1}, + {&__pyx_n_s__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 0, 1, 1}, {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0}, {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, {&__pyx_n_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 1}, - {&__pyx_n_s_arr, __pyx_k_arr, sizeof(__pyx_k_arr), 0, 0, 1, 1}, + {&__pyx_n_s_as_array, __pyx_k_as_array, sizeof(__pyx_k_as_array), 0, 0, 1, 1}, {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1}, {&__pyx_n_s_bpp, __pyx_k_bpp, sizeof(__pyx_k_bpp), 0, 0, 1, 1}, + {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_codec, __pyx_k_codec, sizeof(__pyx_k_codec), 0, 0, 1, 1}, @@ -5762,10 +5961,12 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_u_failed_to_setup_the_decoder, __pyx_k_failed_to_setup_the_decoder, sizeof(__pyx_k_failed_to_setup_the_decoder), 0, 1, 0, 0}, {&__pyx_kp_u_failed_to_upscale_subsampled_com, __pyx_k_failed_to_upscale_subsampled_com, sizeof(__pyx_k_failed_to_upscale_subsampled_com), 0, 1, 0, 0}, {&__pyx_n_s_fp, __pyx_k_fp, sizeof(__pyx_k_fp), 0, 0, 1, 1}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, {&__pyx_n_s_get_parameters, __pyx_k_get_parameters, sizeof(__pyx_k_get_parameters), 0, 0, 1, 1}, {&__pyx_n_s_get_version, __pyx_k_get_version, sizeof(__pyx_k_get_version), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 0, 1, 1}, {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, {&__pyx_n_u_is_signed, __pyx_k_is_signed, sizeof(__pyx_k_is_signed), 0, 1, 0, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, @@ -5782,6 +5983,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0}, {&__pyx_n_s_openjpeg, __pyx_k_openjpeg, sizeof(__pyx_k_openjpeg), 0, 0, 1, 1}, {&__pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_k_openjpeg__openjpeg_pyx, sizeof(__pyx_k_openjpeg__openjpeg_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1}, {&__pyx_n_s_p_in, __pyx_k_p_in, sizeof(__pyx_k_p_in), 0, 0, 1, 1}, {&__pyx_n_s_p_out, __pyx_k_p_out, sizeof(__pyx_k_p_out), 0, 0, 1, 1}, {&__pyx_n_s_p_param, __pyx_k_p_param, sizeof(__pyx_k_p_param), 0, 0, 1, 1}, @@ -5790,11 +5992,13 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_u_precision, __pyx_k_precision, sizeof(__pyx_k_precision), 0, 1, 0, 1}, {&__pyx_n_s_ptr, __pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 0, 1, 1}, {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, {&__pyx_n_u_rows, __pyx_k_rows, sizeof(__pyx_k_rows), 0, 1, 0, 1}, {&__pyx_n_u_sRGB, __pyx_k_sRGB, sizeof(__pyx_k_sRGB), 0, 1, 0, 1}, {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, {&__pyx_kp_u_support_for_more_than_16_bits_pe, __pyx_k_support_for_more_than_16_bits_pe, sizeof(__pyx_k_support_for_more_than_16_bits_pe), 0, 1, 0, 0}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1}, {&__pyx_n_u_unknown, __pyx_k_unknown, sizeof(__pyx_k_unknown), 0, 1, 0, 1}, {&__pyx_n_u_unspecified, __pyx_k_unspecified, sizeof(__pyx_k_unspecified), 0, 1, 0, 1}, @@ -5806,9 +6010,9 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { } /* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 81, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 84, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 986, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 984, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -5819,66 +6023,63 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":986 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":984 * __pyx_import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 986, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 984, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "../../../../../tmp/pip-build-env-6fhf2bk1/overlay/lib/python3.8/site-packages/numpy/__init__.cython-30.pxd":992 + /* "../../../../../tmp/pip-build-env-u57ay04s/overlay/local/lib/python3.10/dist-packages/numpy/__init__.cython-30.pxd":990 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 992, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 990, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "_openjpeg.pyx":37 + /* "_openjpeg.pyx":38 * * - * def get_version(): # <<<<<<<<<<<<<< + * def get_version() -> bytes: # <<<<<<<<<<<<<< * """Return the openjpeg version as bytes.""" * cdef char *version = OpenJpegVersion() */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_version); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_version); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_n_s_get_version, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_n_s_get_version, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 38, __pyx_L1_error) - /* "_openjpeg.pyx":44 + /* "_openjpeg.pyx":45 * * - * def decode(fp, codec=0): # <<<<<<<<<<<<<< - * """Return the decoded JPEG 2000 data from Python file-like `fp`. - * + * def decode( # <<<<<<<<<<<<<< + * fp: BinaryIO, + * codec: int = 0, */ - __pyx_tuple__8 = PyTuple_Pack(10, __pyx_n_s_fp, __pyx_n_s_codec, __pyx_n_s_param, __pyx_n_s_bpp, __pyx_n_s_nr_bytes, __pyx_n_s_p_in, __pyx_n_s_arr, __pyx_n_s_p_out, __pyx_n_s_result, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(10, __pyx_n_s_fp, __pyx_n_s_codec, __pyx_n_s_as_array, __pyx_n_s_param, __pyx_n_s_bpp, __pyx_n_s_nr_bytes, __pyx_n_s_p_in, __pyx_n_s_p_out, __pyx_n_s_out, __pyx_n_s_result); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_n_s_decode, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 44, __pyx_L1_error) - __pyx_tuple__10 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_n_s_decode, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 45, __pyx_L1_error) - /* "_openjpeg.pyx":89 + /* "_openjpeg.pyx":101 * * - * def get_parameters(fp, codec=0): # <<<<<<<<<<<<<< + * def get_parameters(fp: BinaryIO, codec: int = 0) -> Dict[str, Union[str, int, bool]]: # <<<<<<<<<<<<<< * """Return a :class:`dict` containing the JPEG 2000 image parameters. * */ - __pyx_tuple__11 = PyTuple_Pack(10, __pyx_n_s_fp, __pyx_n_s_codec, __pyx_n_s_param, __pyx_n_s_p_param, __pyx_n_s_ptr, __pyx_n_s_result, __pyx_n_s_msg, __pyx_n_s_colours, __pyx_n_s_colourspace, __pyx_n_s_parameters); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_n_s_get_parameters, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(10, __pyx_n_s_fp, __pyx_n_s_codec, __pyx_n_s_param, __pyx_n_s_p_param, __pyx_n_s_ptr, __pyx_n_s_result, __pyx_n_s_msg, __pyx_n_s_colours, __pyx_n_s_colourspace, __pyx_n_s_parameters); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_openjpeg__openjpeg_pyx, __pyx_n_s_get_parameters, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5997,17 +6198,17 @@ static int __Pyx_modinit_type_import_code(void) { __pyx_ptype_5numpy_flatiter = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyArrayIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_7); if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 225, __pyx_L1_error) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyArrayMultiIterObject),__Pyx_ImportType_CheckSize_Ignore_3_0_7); if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 229, __pyx_L1_error) __pyx_ptype_5numpy_ndarray = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyArrayObject),__Pyx_ImportType_CheckSize_Ignore_3_0_7); if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 238, __pyx_L1_error) - __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 812, __pyx_L1_error) - __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 814, __pyx_L1_error) - __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 816, __pyx_L1_error) - __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 818, __pyx_L1_error) - __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 820, __pyx_L1_error) - __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 822, __pyx_L1_error) - __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 824, __pyx_L1_error) - __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 826, __pyx_L1_error) - __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 828, __pyx_L1_error) - __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 830, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_7); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 868, __pyx_L1_error) + __pyx_ptype_5numpy_generic = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_ptype_5numpy_number = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "number", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 811, __pyx_L1_error) + __pyx_ptype_5numpy_integer = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 813, __pyx_L1_error) + __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 815, __pyx_L1_error) + __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 817, __pyx_L1_error) + __pyx_ptype_5numpy_inexact = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 819, __pyx_L1_error) + __pyx_ptype_5numpy_floating = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 821, __pyx_L1_error) + __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 823, __pyx_L1_error) + __pyx_ptype_5numpy_flexible = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 825, __pyx_L1_error) + __pyx_ptype_5numpy_character = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "character", sizeof(PyObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyObject),__Pyx_ImportType_CheckSize_Warn_3_0_7); if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 827, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType_3_0_7(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_7(PyUFuncObject),__Pyx_ImportType_CheckSize_Ignore_3_0_7); if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 866, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; @@ -6316,8 +6517,8 @@ if (!__Pyx_RefNanny) { * # cython: language_level=3 * # distutils: language=c * from math import ceil # <<<<<<<<<<<<<< + * from typing import Union, Dict, BinaryIO * - * from libc.stdint cimport uint32_t */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -6333,74 +6534,147 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_openjpeg.pyx":8 + /* "_openjpeg.pyx":4 + * # distutils: language=c + * from math import ceil + * from typing import Union, Dict, BinaryIO # <<<<<<<<<<<<<< + * + * from libc.stdint cimport uint32_t + */ + __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_n_s_Union); + __Pyx_GIVEREF(__pyx_n_s_Union); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Union)) __PYX_ERR(0, 4, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_Dict); + __Pyx_GIVEREF(__pyx_n_s_Dict); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_Dict)) __PYX_ERR(0, 4, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_BinaryIO); + __Pyx_GIVEREF(__pyx_n_s_BinaryIO); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_BinaryIO)) __PYX_ERR(0, 4, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_3) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_3) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_BinaryIO); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_BinaryIO, __pyx_t_3) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_openjpeg.pyx":9 * * from cpython.ref cimport PyObject * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_3) < 0) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_openjpeg.pyx":26 + /* "_openjpeg.pyx":27 * * ERRORS = { * 1: "failed to create the input stream", # <<<<<<<<<<<<<< * 2: "failed to setup the decoder", * 3: "failed to read the header", */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_int_1, __pyx_kp_u_failed_to_create_the_input_strea) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_2, __pyx_kp_u_failed_to_setup_the_decoder) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_3, __pyx_kp_u_failed_to_read_the_header) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_4, __pyx_kp_u_failed_to_set_the_component_indi) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_5, __pyx_kp_u_failed_to_set_the_decoded_area) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_6, __pyx_kp_u_failed_to_decode_image) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_7, __pyx_kp_u_support_for_more_than_16_bits_pe) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_int_8, __pyx_kp_u_failed_to_upscale_subsampled_com) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ERRORS, __pyx_t_3) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_int_1, __pyx_kp_u_failed_to_create_the_input_strea) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_2, __pyx_kp_u_failed_to_setup_the_decoder) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_3, __pyx_kp_u_failed_to_read_the_header) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_4, __pyx_kp_u_failed_to_set_the_component_indi) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_5, __pyx_kp_u_failed_to_set_the_decoded_area) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_6, __pyx_kp_u_failed_to_decode_image) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_7, __pyx_kp_u_support_for_more_than_16_bits_pe) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_int_8, __pyx_kp_u_failed_to_upscale_subsampled_com) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ERRORS, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_openjpeg.pyx":37 + /* "_openjpeg.pyx":38 * * - * def get_version(): # <<<<<<<<<<<<<< + * def get_version() -> bytes: # <<<<<<<<<<<<<< * """Return the openjpeg version as bytes.""" * cdef char *version = OpenJpegVersion() */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9_openjpeg_1get_version, 0, __pyx_n_s_get_version, NULL, __pyx_n_s_openjpeg, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_bytes) < 0) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9_openjpeg_1get_version, 0, __pyx_n_s_get_version, NULL, __pyx_n_s_openjpeg, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_version, __pyx_t_3) < 0) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_version, __pyx_t_3) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_openjpeg.pyx":44 + /* "_openjpeg.pyx":45 * * - * def decode(fp, codec=0): # <<<<<<<<<<<<<< - * """Return the decoded JPEG 2000 data from Python file-like `fp`. - * + * def decode( # <<<<<<<<<<<<<< + * fp: BinaryIO, + * codec: int = 0, */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9_openjpeg_3decode, 0, __pyx_n_s_decode, NULL, __pyx_n_s_openjpeg, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_fp, __pyx_n_s_BinaryIO) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_codec, __pyx_n_s_int) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_as_array, __pyx_n_s_bool) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_Union_np_ndarray_bytearray) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9_openjpeg_3decode, 0, __pyx_n_s_decode, NULL, __pyx_n_s_openjpeg, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 45, __pyx_L1_error) + + /* "_openjpeg.pyx":47 + * def decode( + * fp: BinaryIO, + * codec: int = 0, # <<<<<<<<<<<<<< + * as_array: bool = False + * ) -> Union[np.ndarray, bytearray]: + */ + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_0); + __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_2)->__pyx_arg_codec = ((PyObject*)__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_9_openjpeg_6__defaults__); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_openjpeg.pyx":89 + /* "_openjpeg.pyx":101 * * - * def get_parameters(fp, codec=0): # <<<<<<<<<<<<<< + * def get_parameters(fp: BinaryIO, codec: int = 0) -> Dict[str, Union[str, int, bool]]: # <<<<<<<<<<<<<< * """Return a :class:`dict` containing the JPEG 2000 image parameters. * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9_openjpeg_5get_parameters, 0, __pyx_n_s_get_parameters, NULL, __pyx_n_s_openjpeg, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_fp, __pyx_n_s_BinaryIO) < 0) __PYX_ERR(0, 101, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_codec, __pyx_n_s_int) < 0) __PYX_ERR(0, 101, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_Dict_str_Union_str_int_bool) < 0) __PYX_ERR(0, 101, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9_openjpeg_5get_parameters, 0, __pyx_n_s_get_parameters, NULL, __pyx_n_s_openjpeg, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__10); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_parameters, __pyx_t_3) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + if (!__Pyx_CyFunction_InitDefaults(__pyx_t_3, sizeof(__pyx_defaults1), 1)) __PYX_ERR(0, 101, __pyx_L1_error) + if (!(likely(__Pyx_Py3Int_CheckExact(__pyx_int_0)) || __Pyx_RaiseUnexpectedTypeError("int", __pyx_int_0))) __PYX_ERR(0, 101, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_0); + __Pyx_CyFunction_Defaults(__pyx_defaults1, __pyx_t_3)->__pyx_arg_codec = ((PyObject*)__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_3, __pyx_pf_9_openjpeg_8__defaults__); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_parameters, __pyx_t_3) < 0) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "_openjpeg.pyx":1 @@ -7425,6 +7699,33 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { @@ -7859,6 +8160,12 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; @@ -7959,12 +8266,6 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } -/* PyObjectCallOneArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *args[2] = {NULL, arg}; - return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType_3_0_7 #define __PYX_HAVE_RT_ImportType_3_0_7 @@ -9524,6 +9825,17 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } +/* RaiseUnexpectedTypeError */ +static int +__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) +{ + __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, + expected, obj_type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { @@ -10646,7 +10958,7 @@ __Pyx_PyType_GetName(PyTypeObject* tp) if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { PyErr_Clear(); Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__13); + name = __Pyx_NewRef(__pyx_n_s__12); } return name; } diff --git a/openjpeg/_openjpeg.pyx b/openjpeg/_openjpeg.pyx index 2498189..42fd041 100644 --- a/openjpeg/_openjpeg.pyx +++ b/openjpeg/_openjpeg.pyx @@ -1,6 +1,7 @@ # cython: language_level=3 # distutils: language=c from math import ceil +from typing import Union, Dict, BinaryIO from libc.stdint cimport uint32_t @@ -34,14 +35,18 @@ ERRORS = { } -def get_version(): +def get_version() -> bytes: """Return the openjpeg version as bytes.""" cdef char *version = OpenJpegVersion() return version -def decode(fp, codec=0): +def decode( + fp: BinaryIO, + codec: int = 0, + as_array: bool = False +) -> Union[np.ndarray, bytearray]: """Return the decoded JPEG 2000 data from Python file-like `fp`. Parameters @@ -55,11 +60,16 @@ def decode(fp, codec=0): * ``0``: JPEG-2000 codestream * ``1``: JPT-stream (JPEG 2000, JPIP) * ``2``: JP2 file format + as_array : bool, optional + If ``True`` then return the decoded image data as a :class:`numpy.ndarray` + otherwise return the data as a :class:`bytearray` (default). Returns ------- - numpy.ndarray - An ndarray of uint8 containing the decoded image data. + bytearray | numpy.ndarray + If `as_array` is False (default) then returns the decoded image data + as a :class:`bytearray`, otherwise returns the image data as a + :class:`numpy.ndarray`. Raises ------ @@ -71,22 +81,24 @@ def decode(fp, codec=0): nr_bytes = param['rows'] * param['columns'] * param['nr_components'] * bpp cdef PyObject* p_in = fp - arr = np.zeros(nr_bytes, dtype=np.uint8) - cdef unsigned char *p_out = np.PyArray_DATA(arr) + cdef unsigned char *p_out + if as_array: + out = np.zeros(nr_bytes, dtype=np.uint8) + p_out = np.PyArray_DATA(out) + else: + out = bytearray(nr_bytes) + p_out = out result = Decode(p_in, p_out, codec) if result != 0: - try: - msg = f": {ERRORS[result]}" - except KeyError: - pass - - raise RuntimeError("Error decoding the J2K data" + msg) + raise RuntimeError( + f"Error decoding the J2K data: {ERRORS.get(result, result)}" + ) - return arr + return out -def get_parameters(fp, codec=0): +def get_parameters(fp: BinaryIO, codec: int = 0) -> Dict[str, Union[str, int, bool]]: """Return a :class:`dict` containing the JPEG 2000 image parameters. Parameters diff --git a/openjpeg/src/openjpeg b/openjpeg/src/openjpeg index 37ac30c..a589155 160000 --- a/openjpeg/src/openjpeg +++ b/openjpeg/src/openjpeg @@ -1 +1 @@ -Subproject commit 37ac30ceff6640bbab502388c5e0fa0bff23f505 +Subproject commit a5891555eb49ed7cc26b2901ea680acda136d811 diff --git a/openjpeg/tests/test_decode.py b/openjpeg/tests/test_decode.py index dbe0249..7f2ff7c 100644 --- a/openjpeg/tests/test_decode.py +++ b/openjpeg/tests/test_decode.py @@ -17,7 +17,12 @@ import pytest from openjpeg.data import get_indexed_datasets, JPEG_DIRECTORY -from openjpeg.utils import get_openjpeg_version, decode, get_parameters +from openjpeg.utils import ( + get_openjpeg_version, + decode, + get_parameters, + decode_pixel_data, +) DIR_15444 = JPEG_DIRECTORY / '15444' @@ -84,7 +89,7 @@ def test_bad_decode(): decode(frame) -class TestDecode(object): +class TestDecode: """General tests for decode.""" @pytest.mark.skipif(not HAS_PYDICOM, reason="No pydicom") def test_decode_bytes(self): @@ -217,9 +222,97 @@ def test_decode_subsampled(self): assert (256, 256, 3) == arr.shape assert [235, 244, 245] == arr[0, 0, :].tolist() + def test_reference_J2KLS(self): + """Test the reference J2KLS images.""" + d = DIR_15444 / "2KLS" + arr = decode(d / "693.j2k") + assert arr[270, 55:65].tolist() == [ + 340, 815, 1229, 1358, 1351, 1302, 1069, 618, 215, 71 + ] + arr = decode(d / "oj36.j2k") + assert arr[60, 35:45].tolist() == [ + [160, 171, 199], + [174, 182, 193], + [190, 198, 209], + [209, 217, 213], + [219, 227, 223], + [226, 235, 221], + [233, 242, 228], + [239, 246, 236], + [243, 250, 240], + [247, 250, 248], + ] + + def test_reference_HTJ2K(self): + """Test the reference HTJ2K images.""" + d = DIR_15444 / "HTJ2K" + + arr = decode(d / "Bretagne1_ht_lossy.j2k") + assert arr[160, 295:305].tolist() == [ + [ 91, 37, 2], + [ 94, 40, 1], + [ 97, 42, 5], + [174, 123, 59], + [172, 132, 69], + [169, 134, 74], + [168, 136, 77], + [168, 137, 80], + [168, 136, 80], + [169, 136, 78], + ] + assert arr[275:285, 635].tolist() == [ + [207, 193, 171], + [238, 229, 215], + [235, 228, 216], + [233, 226, 213], + [238, 231, 218], + [239, 232, 219], + [225, 218, 206], + [240, 234, 223], + [247, 240, 232], + [242, 236, 227], + ] + + arr = decode(d / "Bretagne1_ht.j2k") + assert arr[160, 295:305].tolist() == [ + [ 90, 38, 1], + [ 94, 40, 1], + [ 97, 42, 5], + [173, 122, 59], + [172, 133, 69], + [169, 135, 75], + [168, 136, 79], + [169, 137, 79], + [169, 137, 81], + [169, 136, 79], + ] + assert arr[275:285, 635].tolist() == [ + [208, 193, 172], + [238, 228, 215], + [235, 229, 216], + [233, 226, 212], + [239, 231, 218], + [238, 232, 219], + [224, 218, 205], + [239, 234, 223], + [246, 241, 232], + [242, 236, 226], + ] + + def test_decode_pixel_data(self): + """Test decode_pixel_data""" + d = DIR_15444 / "2KLS" + with (d / "693.j2k").open("rb") as f: + buffer = decode_pixel_data(f.read(), version=2) + assert isinstance(buffer, bytearray) + arr = np.frombuffer(buffer, dtype="i2").reshape((512, 512)) + assert arr[270, 55:65].tolist() == [ + 340, 815, 1229, 1358, 1351, 1302, 1069, 618, 215, 71 + ] + @pytest.mark.skipif(not HAS_PYDICOM, reason="No pydicom") -class TestDecodeDCM(object): +class TestDecodeDCM: """Tests for get_parameters() using DICOM datasets.""" @pytest.mark.parametrize("fname, info", REF_DCM['1.2.840.10008.1.2.4.90']) def test_jpeg2000r(self, fname, info): diff --git a/openjpeg/tests/test_handler.py b/openjpeg/tests/test_handler.py index e8af954..1b4fc6f 100644 --- a/openjpeg/tests/test_handler.py +++ b/openjpeg/tests/test_handler.py @@ -24,7 +24,7 @@ def generate_frames(ds): @pytest.mark.skipif(not HAS_PYDICOM, reason="pydicom unavailable") -class TestHandler(object): +class TestHandler: """Tests for the pixel data handler.""" def test_invalid_type_raises(self): """Test decoding using invalid type raises.""" @@ -33,10 +33,7 @@ def test_invalid_type_raises(self): frame = tuple(next(generate_frames(ds))) assert not hasattr(frame, 'tell') and not isinstance(frame, bytes) - msg = ( - r"The Python object containing the encoded JPEG 2000 data must " - r"either be bytes or have read\(\), tell\(\) and seek\(\) methods." - ) + msg = "a bytes-like object is required, not 'tuple'" with pytest.raises(TypeError, match=msg): decode_pixel_data(frame) @@ -51,7 +48,7 @@ def test_no_dataset(self): assert (length,) == arr.shape -class HandlerTestBase(object): +class HandlerTestBase: """Baseclass for handler tests.""" uid = None @@ -76,7 +73,7 @@ def plot(self, arr, index=None, cmap=None): @pytest.mark.skipif(not HAS_PYDICOM, reason="No dependencies") -class TestLibrary(object): +class TestLibrary: """Tests for libjpeg itself.""" def test_non_conformant_raises(self): """Test that a non-conformant JPEG image raises an exception.""" diff --git a/openjpeg/tests/test_parameters.py b/openjpeg/tests/test_parameters.py index cba9785..7f7511a 100644 --- a/openjpeg/tests/test_parameters.py +++ b/openjpeg/tests/test_parameters.py @@ -66,18 +66,22 @@ def test_bad_decode(): with pytest.raises(RuntimeError, match=msg): get_parameters(stream) + def test_subsampling(): """Test parameters with subsampled data (see #36).""" jpg = DIR_15444 / "2KLS" / "oj36.j2k" params = get_parameters(jpg) - print(params) - # 0: (1, 1) - # 1: (2, 1) - # 2: (2, 1) + assert params["rows"] == 256 + assert params["columns"] == 256 + assert params["colourspace"] == "unspecified" + assert params["nr_components"] == 3 + assert params["precision"] == 8 + assert params["is_signed"] is False + assert params["nr_tiles"] == 0 @pytest.mark.skipif(not HAS_PYDICOM, reason="No pydicom") -class TestGetParametersDCM(object): +class TestGetParametersDCM: """Tests for get_parameters() using DICOM datasets.""" @pytest.mark.parametrize("fname, info", REF_DCM['1.2.840.10008.1.2.4.90']) def test_jpeg2000r(self, fname, info): diff --git a/openjpeg/utils.py b/openjpeg/utils.py index 0a10b0b..e4c5365 100644 --- a/openjpeg/utils.py +++ b/openjpeg/utils.py @@ -1,4 +1,5 @@ +from enum import IntEnum from io import BytesIO from math import ceil import os @@ -15,6 +16,11 @@ from pydicom.dataset import Dataset +class Version(IntEnum): + v1 = 1 + v2 = 2 + + def _get_format(stream: BinaryIO) -> int: """Return the JPEG 2000 format for the encoded data in `stream`. @@ -122,7 +128,7 @@ def decode( "The Python object containing the encoded JPEG 2000 data must " "either be bytes or have read(), tell() and seek() methods." ) - buffer = stream + buffer = cast(BinaryIO, stream) if j2k_format is None: j2k_format = _get_format(buffer) @@ -130,7 +136,7 @@ def decode( if j2k_format not in [0, 1, 2]: raise ValueError(f"Unsupported 'j2k_format' value: {j2k_format}") - arr = cast(np.ndarray, _openjpeg.decode(buffer, j2k_format)) + arr = cast(np.ndarray, _openjpeg.decode(buffer, j2k_format, as_array=True)) if not reshape: return arr @@ -153,17 +159,18 @@ def decode( def decode_pixel_data( - stream: Union[bytes, bytearray, BinaryIO], - ds: "Dataset" = None, + src: bytes, + ds: Union["Dataset", Dict[str, Any], None] = None, + version: int = Version.v1, **kwargs: Any -) -> np.ndarray: +) -> Union[np.ndarray, bytearray]: """Return the decoded JPEG 2000 data as a :class:`numpy.ndarray`. Intended for use with *pydicom* ``Dataset`` objects. Parameters ---------- - stream : bytes or file-like + src : bytes A Python object containing the encoded JPEG 2000 data. If not :class:`bytes` then the object must have ``tell()``, ``seek()`` and ``read()`` methods. @@ -173,81 +180,83 @@ def decode_pixel_data( *Samples per Pixel*, *Bits Stored* and *Pixel Representation* values will be checked against the JPEG 2000 data and warnings issued if different. + version : int, optional + + * If ``1`` (default) then return the image data as an :class:`numpy.ndarray` + * If ``2`` then return the image data as :class:`bytearray` Returns ------- - numpy.ndarray - A 1D array of ``numpy.uint8`` containing the decoded image data. + bytearray | numpy.ndarray + The image data as either a bytearray or ndarray. Raises ------ RuntimeError If the decoding failed. """ - if isinstance(stream, (bytes, bytearray)): - stream = BytesIO(stream) - - required_methods = ["read", "tell", "seek"] - if not all([hasattr(stream, meth) for meth in required_methods]): - raise TypeError( - "The Python object containing the encoded JPEG 2000 data must " - "either be bytes or have read(), tell() and seek() methods." - ) + buffer = BytesIO(src) + j2k_format = _get_format(buffer) + + # Version 1 + if version == Version.v1: + if j2k_format != 0: + warnings.warn( + "The (7FE0,0010) Pixel Data contains a JPEG 2000 codestream " + "with the optional JP2 file format header, which is " + "non-conformant to the DICOM Standard (Part 5, Annex A.4.4)" + ) - j2k_format = _get_format(stream) - if j2k_format != 0: - warnings.warn( - "The (7FE0,0010) Pixel Data contains a JPEG 2000 codestream " - "with the optional JP2 file format header, which is " - "non-conformant to the DICOM Standard (Part 5, Annex A.4.4)" + arr = _openjpeg.decode(buffer, j2k_format, as_array=True) + + samples_per_pixel = kwargs.get("samples_per_pixel") + bits_stored = kwargs.get("bits_stored") + pixel_representation = kwargs.get("pixel_representation") + no_kwargs = None in ( + samples_per_pixel, bits_stored, pixel_representation ) - arr = _openjpeg.decode(stream, j2k_format) + if not ds and no_kwargs: + return cast(np.ndarray, arr) - samples_per_pixel = kwargs.get("samples_per_pixel") - bits_stored = kwargs.get("bits_stored") - pixel_representation = kwargs.get("pixel_representation") - no_kwargs = None in ( - samples_per_pixel, bits_stored, pixel_representation - ) - if not ds and no_kwargs: - return cast(np.ndarray, arr) + samples_per_pixel = ds.get("SamplesPerPixel", samples_per_pixel) + bits_stored = ds.get("BitsStored", bits_stored) + pixel_representation = ds.get("PixelRepresentation", pixel_representation) - samples_per_pixel = ds.get("SamplesPerPixel", samples_per_pixel) - bits_stored = ds.get("BitsStored", bits_stored) - pixel_representation = ds.get("PixelRepresentation", pixel_representation) - - meta = get_parameters(stream, j2k_format) - if samples_per_pixel != meta["nr_components"]: - warnings.warn( - f"The (0028,0002) Samples per Pixel value '{samples_per_pixel}' " - f"in the dataset does not match the number of components " - f"\'{meta['nr_components']}\' found in the JPEG 2000 data. " - f"It's recommended that you change the Samples per Pixel value " - f"to produce the correct output" - ) + meta = get_parameters(buffer, j2k_format) + if samples_per_pixel != meta["nr_components"]: + warnings.warn( + f"The (0028,0002) Samples per Pixel value '{samples_per_pixel}' " + f"in the dataset does not match the number of components " + f"\'{meta['nr_components']}\' found in the JPEG 2000 data. " + f"It's recommended that you change the Samples per Pixel value " + f"to produce the correct output" + ) - if bits_stored != meta["precision"]: - warnings.warn( - f"The (0028,0101) Bits Stored value '{bits_stored}' in the " - f"dataset does not match the component precision value " - f"\'{meta['precision']}\' found in the JPEG 2000 data. " - f"It's recommended that you change the Bits Stored value to " - f"produce the correct output" - ) + if bits_stored != meta["precision"]: + warnings.warn( + f"The (0028,0101) Bits Stored value '{bits_stored}' in the " + f"dataset does not match the component precision value " + f"\'{meta['precision']}\' found in the JPEG 2000 data. " + f"It's recommended that you change the Bits Stored value to " + f"produce the correct output" + ) - if bool(pixel_representation) != meta["is_signed"]: - val = "signed" if meta["is_signed"] else "unsigned" - ds_val = "signed" if bool(pixel_representation) else "unsigned" - ds_val = f"'{pixel_representation}' ({ds_val})" - warnings.warn( - f"The (0028,0103) Pixel Representation value {ds_val} in the " - f"dataset does not match the format of the values found in the " - f"JPEG 2000 data '{val}'" - ) + if bool(pixel_representation) != meta["is_signed"]: + val = "signed" if meta["is_signed"] else "unsigned" + ds_val = "signed" if bool(pixel_representation) else "unsigned" + ds_val = f"'{pixel_representation}' ({ds_val})" + warnings.warn( + f"The (0028,0103) Pixel Representation value {ds_val} in the " + f"dataset does not match the format of the values found in the " + f"JPEG 2000 data '{val}'" + ) + + return cast(np.ndarray, arr) - return cast(np.ndarray, arr) + # Version 2 + return cast(bytearray, _openjpeg.decode(buffer, j2k_format, as_array=False)) def get_parameters( @@ -301,7 +310,7 @@ def get_parameters( "The Python object containing the encoded JPEG 2000 data must " "either be bytes or have read(), tell() and seek() methods." ) - buffer = stream + buffer = cast(BinaryIO, stream) if j2k_format is None: j2k_format = _get_format(buffer) diff --git a/poetry.lock b/poetry.lock index 51fe9b9..6325378 100644 --- a/poetry.lock +++ b/poetry.lock @@ -354,7 +354,7 @@ name = "pylibjpeg-data" version = "1.0.0.dev0" description = "Optional JPEG and DICOM data used for testing pylibjpeg" optional = true -python-versions = ">=3.6" +python-versions = ">=3.8" files = [] develop = false @@ -362,7 +362,7 @@ develop = false type = "git" url = "https://github.com/pydicom/pylibjpeg-data.git" reference = "HEAD" -resolved_reference = "2ab4b8a65b070656eca2582bd23197a3d01cdccd" +resolved_reference = "916aa154a06ac6e85678d8bcffe4273814752c96" [[package]] name = "pytest" diff --git a/pyproject.toml b/pyproject.toml index bcb9e14..397606b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,20 +14,20 @@ generate-setup-file = true [tool.poetry] authors = ["pylibjpeg-openjpeg contributors"] classifiers=[ -"License :: OSI Approved :: MIT License", -"Intended Audience :: Developers", -"Intended Audience :: Healthcare Industry", -"Intended Audience :: Science/Research", -"Development Status :: 5 - Production/Stable", -"Natural Language :: English", -"Programming Language :: Python :: 3.8", -"Programming Language :: Python :: 3.9", -"Programming Language :: Python :: 3.10", -"Programming Language :: Python :: 3.11", -"Programming Language :: Python :: 3.12", -"Operating System :: OS Independent", -"Topic :: Scientific/Engineering :: Medical Science Apps.", -"Topic :: Software Development :: Libraries", + "License :: OSI Approved :: MIT License", + "Intended Audience :: Developers", + "Intended Audience :: Healthcare Industry", + "Intended Audience :: Science/Research", + "Development Status :: 5 - Production/Stable", + "Natural Language :: English", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: OS Independent", + "Topic :: Scientific/Engineering :: Medical Science Apps.", + "Topic :: Software Development :: Libraries", ] description = """\ "A Python wrapper for openjpeg, with a focus on use as a plugin for "\ @@ -79,6 +79,9 @@ openjpeg = "openjpeg:decode" [tool.poetry.plugins."pylibjpeg.pixel_data_decoders"] "1.2.840.10008.1.2.4.90" = "openjpeg:decode_pixel_data" "1.2.840.10008.1.2.4.91" = "openjpeg:decode_pixel_data" +"1.2.840.10008.1.2.4.201" = "openjpeg:decode_pixel_data" +"1.2.840.10008.1.2.4.202" = "openjpeg:decode_pixel_data" +"1.2.840.10008.1.2.4.203" = "openjpeg:decode_pixel_data" [tool.coverage.run]