diff --git a/apis/python/src/tiledbsoma/query_condition.py b/apis/python/src/tiledbsoma/query_condition.py index ebe6d505b9..9440bbdb15 100644 --- a/apis/python/src/tiledbsoma/query_condition.py +++ b/apis/python/src/tiledbsoma/query_condition.py @@ -4,7 +4,7 @@ import ast from dataclasses import dataclass, field -from typing import Any, Callable, List, Tuple, Type, Union +from typing import Any, Callable, List, Tuple, Union import numpy as np import tiledb @@ -183,7 +183,7 @@ def visit_In(self, node): def visit_List(self, node): return list(node.elts) - def visit_Compare(self, node: Type[ast.Compare]) -> PyQueryCondition: + def visit_Compare(self, node: ast.Compare) -> PyQueryCondition: operator = self.visit(node.ops[0]) if operator in ( diff --git a/apis/python/tests/__init__.py b/apis/python/tests/__init__.py index 5df0213e85..110ab9a200 100644 --- a/apis/python/tests/__init__.py +++ b/apis/python/tests/__init__.py @@ -1,7 +1,18 @@ import pyarrow as pa -from typeguard.importhook import install_import_hook +from typeguard.importhook import TypeguardFinder, install_import_hook -install_import_hook("tiledbsoma") +class CustomFinder(TypeguardFinder): + """ + As noted in apis/python/src/tiledbsoma/query_condition.py we intentionally + suppress ``mypy`` there. However we need this extra step to also suppress + ``typeguard`` there. + """ + def should_instrument(self, module_name: str): + if module_name == 'tiledbsoma.query_condition': + return False + return True + +install_import_hook("tiledbsoma", cls=CustomFinder) """Types supported in a SOMA*NdArray """ NDARRAY_ARROW_TYPES_SUPPORTED = [