Skip to content

Commit

Permalink
fix typeguard CI fail
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Oct 12, 2022
1 parent 55d2cf9 commit cfb14ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apis/python/src/tiledbsoma/query_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
Expand Down
15 changes: 13 additions & 2 deletions apis/python/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down

0 comments on commit cfb14ae

Please sign in to comment.