Skip to content

Commit

Permalink
Update for mypy 0.910
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jul 2, 2021
1 parent c44dd57 commit e7f41ec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 47 deletions.
4 changes: 4 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RELEASE_TYPE: patch

This patch updates our internal annotations for :pypi:`mypy` 0.910,
which supports more precise annotations for :func:`~hypothesis.strategies.one_of`.
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/pytz.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import datetime as dt

import pytz
from pytz.tzfile import StaticTzInfo
from pytz.tzfile import StaticTzInfo # type: ignore # incomplete stubs

from hypothesis import strategies as st
from hypothesis.strategies._internal.utils import cacheable, defines_strategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def lists(
and len(unique_by) == 1
and (
# Introspection for either `itemgetter(0)`, or `lambda x: x[0]`
isinstance(unique_by[0], operator.itemgetter) # type: ignore
isinstance(unique_by[0], operator.itemgetter)
and repr(unique_by[0]) == "operator.itemgetter(0)"
or isinstance(unique_by[0], FunctionType)
and re.fullmatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -675,52 +675,12 @@ def filter(self, condition):


@overload
def one_of(args: Sequence[SearchStrategy[Any]]) -> SearchStrategy[Any]:
def one_of(args: Sequence[SearchStrategy[Ex]]) -> SearchStrategy[Ex]:
raise NotImplementedError


@overload # noqa: F811
def one_of(a1: SearchStrategy[Ex]) -> SearchStrategy[Ex]:
raise NotImplementedError


@overload # noqa: F811
def one_of(
a1: SearchStrategy[Ex], a2: SearchStrategy[T]
) -> SearchStrategy[Union[Ex, T]]:
raise NotImplementedError


@overload # noqa: F811
def one_of(
a1: SearchStrategy[Ex], a2: SearchStrategy[T], a3: SearchStrategy[T3]
) -> SearchStrategy[Union[Ex, T, T3]]:
raise NotImplementedError


@overload # noqa: F811
def one_of(
a1: SearchStrategy[Ex],
a2: SearchStrategy[T],
a3: SearchStrategy[T3],
a4: SearchStrategy[T4],
) -> SearchStrategy[Union[Ex, T, T3, T4]]:
raise NotImplementedError


@overload # noqa: F811
def one_of(
a1: SearchStrategy[Ex],
a2: SearchStrategy[T],
a3: SearchStrategy[T3],
a4: SearchStrategy[T4],
a5: SearchStrategy[T5],
) -> SearchStrategy[Union[Ex, T, T3, T4, T5]]:
raise NotImplementedError


@overload # noqa: F811
def one_of(*args: SearchStrategy[Any]) -> SearchStrategy[Any]:
def one_of(*args: SearchStrategy[Ex]) -> SearchStrategy[Ex]:
raise NotImplementedError


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ def _networks(bits):
UnicodeTranslateError, st.text(), st.just(0), st.just(0), st.just("reason")
),
enumerate: st.builds(enumerate, st.just(())),
filter: st.builds(filter, st.just(lambda _: None), st.just(())), # type: ignore
map: st.builds(map, st.just(lambda _: None), st.just(())), # type: ignore
reversed: st.builds(reversed, st.just(())), # type: ignore
filter: st.builds(filter, st.just(lambda _: None), st.just(())),
map: st.builds(map, st.just(lambda _: None), st.just(())),
reversed: st.builds(reversed, st.just(())),
classmethod: st.builds(classmethod, st.just(lambda self: self)),
staticmethod: st.builds(staticmethod, st.just(lambda self: self)),
super: st.builds(super, st.from_type(type)),
Expand Down

0 comments on commit e7f41ec

Please sign in to comment.