Skip to content

Commit

Permalink
Fix type hints for new mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Oct 2, 2022
1 parent 21fcfdd commit b36c896
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/array_api.py
Expand Up @@ -163,7 +163,7 @@ def find_castable_builtin_for_dtype(


@check_function
def dtype_from_name(xp: Any, name: str) -> DataType:
def dtype_from_name(xp: Any, name: str) -> Any:
if name in DTYPE_NAMES:
try:
return getattr(xp, name)
Expand Down
Expand Up @@ -589,7 +589,7 @@ def do_filtered_draw(self, data):
return filter_not_satisfied


class OneOfStrategy(SearchStrategy):
class OneOfStrategy(SearchStrategy[Ex]):
"""Implements a union of strategies. Given a number of strategies this
generates values which could have come from any of them.
Expand Down Expand Up @@ -781,7 +781,7 @@ def one_of(
return OneOfStrategy(args)


class MappedSearchStrategy(SearchStrategy):
class MappedSearchStrategy(SearchStrategy[Ex]):
"""A strategy which is defined purely by conversion to and from another
strategy.
Expand Down Expand Up @@ -816,7 +816,7 @@ def pack(self, x):
into a value suitable for outputting from this strategy."""
raise NotImplementedError(f"{self.__class__.__name__}.pack()")

def do_draw(self, data: ConjectureData) -> Ex:
def do_draw(self, data: ConjectureData) -> Any:
with warnings.catch_warnings():
if isinstance(self.pack, type) and issubclass(
self.pack, (abc.Mapping, abc.Set)
Expand All @@ -826,7 +826,7 @@ def do_draw(self, data: ConjectureData) -> Ex:
i = data.index
try:
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
result = self.pack(data.draw(self.mapped_strategy))
result = self.pack(data.draw(self.mapped_strategy)) # type: ignore
data.stop_example()
return result
except UnsatisfiedAssumption:
Expand All @@ -846,7 +846,7 @@ def branches(self) -> List[SearchStrategy[Ex]]:
filter_not_satisfied = UniqueIdentifier("filter not satisfied")


class FilteredStrategy(SearchStrategy):
class FilteredStrategy(SearchStrategy[Ex]):
def __init__(self, strategy, conditions):
super().__init__()
if isinstance(strategy, FilteredStrategy):
Expand Down

0 comments on commit b36c896

Please sign in to comment.