Skip to content

Commit b36c896

Browse files
committed
Fix type hints for new mypy
1 parent 21fcfdd commit b36c896

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

hypothesis-python/src/hypothesis/extra/array_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def find_castable_builtin_for_dtype(
163163

164164

165165
@check_function
166-
def dtype_from_name(xp: Any, name: str) -> DataType:
166+
def dtype_from_name(xp: Any, name: str) -> Any:
167167
if name in DTYPE_NAMES:
168168
try:
169169
return getattr(xp, name)

hypothesis-python/src/hypothesis/strategies/_internal/strategies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ def do_filtered_draw(self, data):
589589
return filter_not_satisfied
590590

591591

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

783783

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

819-
def do_draw(self, data: ConjectureData) -> Ex:
819+
def do_draw(self, data: ConjectureData) -> Any:
820820
with warnings.catch_warnings():
821821
if isinstance(self.pack, type) and issubclass(
822822
self.pack, (abc.Mapping, abc.Set)
@@ -826,7 +826,7 @@ def do_draw(self, data: ConjectureData) -> Ex:
826826
i = data.index
827827
try:
828828
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
829-
result = self.pack(data.draw(self.mapped_strategy))
829+
result = self.pack(data.draw(self.mapped_strategy)) # type: ignore
830830
data.stop_example()
831831
return result
832832
except UnsatisfiedAssumption:
@@ -846,7 +846,7 @@ def branches(self) -> List[SearchStrategy[Ex]]:
846846
filter_not_satisfied = UniqueIdentifier("filter not satisfied")
847847

848848

849-
class FilteredStrategy(SearchStrategy):
849+
class FilteredStrategy(SearchStrategy[Ex]):
850850
def __init__(self, strategy, conditions):
851851
super().__init__()
852852
if isinstance(strategy, FilteredStrategy):

0 commit comments

Comments
 (0)