This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 0ca0f9e6 fix(python): correct typechecking error (#1604)
0ca0f9e6 is described below

commit 0ca0f9e6bc3c548b0fb1402b4f0e5587d4846a8a
Author: David Li <[email protected]>
AuthorDate: Fri Mar 8 14:14:47 2024 -0500

    fix(python): correct typechecking error (#1604)
---
 ci/scripts/python_typecheck.sh                     | 24 +++++++++++++++++-----
 .../adbc_driver_flightsql/__init__.py              |  2 +-
 .../adbc_driver_postgresql/__init__.py             |  2 +-
 .../adbc_driver_snowflake/__init__.py              |  2 +-
 .../adbc_driver_sqlite/__init__.py                 |  2 +-
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/ci/scripts/python_typecheck.sh b/ci/scripts/python_typecheck.sh
index 71649ca8..3c6195af 100755
--- a/ci/scripts/python_typecheck.sh
+++ b/ci/scripts/python_typecheck.sh
@@ -30,25 +30,39 @@ set -e
 main() {
     local -r source_dir="${1}"
 
+    local status=0
+
     if [[ "${BUILD_DRIVER_FLIGHTSQL}" -gt 0 ]]; then
-        pyright ${PYRIGHT_OPTIONS} "${source_dir}/python/adbc_driver_flightsql"
+        if ! pyright ${PYRIGHT_OPTIONS} 
"${source_dir}/python/adbc_driver_flightsql"; then
+            status=1
+        fi
     fi
 
     if [[ "${BUILD_DRIVER_MANAGER}" -gt 0 ]]; then
-        pyright ${PYRIGHT_OPTIONS} "${source_dir}/python/adbc_driver_manager"
+        if ! pyright ${PYRIGHT_OPTIONS} 
"${source_dir}/python/adbc_driver_manager"; then
+            status=1
+        fi
     fi
 
     if [[ "${BUILD_DRIVER_POSTGRESQL}" -gt 0 ]]; then
-        pyright ${PYRIGHT_OPTIONS} 
"${source_dir}/python/adbc_driver_postgresql"
+        if ! pyright ${PYRIGHT_OPTIONS} 
"${source_dir}/python/adbc_driver_postgresql"; then
+            status=1
+        fi
     fi
 
     if [[ "${BUILD_DRIVER_SQLITE}" -gt 0 ]]; then
-        pyright ${PYRIGHT_OPTIONS} "${source_dir}/python/adbc_driver_sqlite"
+        if ! pyright ${PYRIGHT_OPTIONS} 
"${source_dir}/python/adbc_driver_sqlite"; then
+            status=1
+        fi
     fi
 
     if [[ "${BUILD_DRIVER_SNOWFLAKE}" -gt 0 ]]; then
-        pyright ${PYRIGHT_OPTIONS} "${source_dir}/python/adbc_driver_snowflake"
+        if ! pyright ${PYRIGHT_OPTIONS} 
"${source_dir}/python/adbc_driver_snowflake"; then
+            status=1
+        fi
     fi
+
+    return $status
 }
 
 main "$@"
diff --git a/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py 
b/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py
index 1af0c199..e50f7c5a 100644
--- a/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py
+++ b/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py
@@ -173,7 +173,7 @@ def _driver_path() -> str:
     driver = "adbc_driver_flightsql"
 
     # Wheels bundle the shared library
-    root = importlib.resources.files(__package__)
+    root = importlib.resources.files(driver)
     # The filename is always the same regardless of platform
     entrypoint = root.joinpath(f"lib{driver}.so")
     if entrypoint.is_file():
diff --git a/python/adbc_driver_postgresql/adbc_driver_postgresql/__init__.py 
b/python/adbc_driver_postgresql/adbc_driver_postgresql/__init__.py
index bd900492..ac311b64 100644
--- a/python/adbc_driver_postgresql/adbc_driver_postgresql/__init__.py
+++ b/python/adbc_driver_postgresql/adbc_driver_postgresql/__init__.py
@@ -49,7 +49,7 @@ def _driver_path() -> str:
     driver = "adbc_driver_postgresql"
 
     # Wheels bundle the shared library
-    root = importlib.resources.files(__package__)
+    root = importlib.resources.files(driver)
     # The filename is always the same regardless of platform
     entrypoint = root.joinpath(f"lib{driver}.so")
     if entrypoint.is_file():
diff --git a/python/adbc_driver_snowflake/adbc_driver_snowflake/__init__.py 
b/python/adbc_driver_snowflake/adbc_driver_snowflake/__init__.py
index 19b3bbc1..32dae68c 100644
--- a/python/adbc_driver_snowflake/adbc_driver_snowflake/__init__.py
+++ b/python/adbc_driver_snowflake/adbc_driver_snowflake/__init__.py
@@ -147,7 +147,7 @@ def _driver_path() -> str:
     driver = "adbc_driver_snowflake"
 
     # Wheels bundle the shared library
-    root = importlib.resources.files(__package__)
+    root = importlib.resources.files(driver)
     # The filename is always the same regardless of platform
     entrypoint = root.joinpath(f"lib{driver}.so")
     if entrypoint.is_file():
diff --git a/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py 
b/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py
index 6f777ff0..255ecf6d 100644
--- a/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py
+++ b/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py
@@ -69,7 +69,7 @@ def _driver_path() -> str:
     driver = "adbc_driver_sqlite"
 
     # Wheels bundle the shared library
-    root = importlib.resources.files(__package__)
+    root = importlib.resources.files(driver)
     # The filename is always the same regardless of platform
     entrypoint = root.joinpath(f"lib{driver}.so")
     if entrypoint.is_file():

Reply via email to