Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Apr 24, 2023
1 parent 1713b31 commit 1c7cd4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
RELEASE_TYPE: patch

Numpy array strategy returned dtype is always unkown but it's actually specified
as parameter.

This patch made that relationship between dtype parameters and returned strategy
dtype explicit.
This patch fixes type annotations for the :func:`~hypothesis.extra.numpy.arrays`
strategy. Thanks to Francesc Elies for :pull:`3602`.
3 changes: 2 additions & 1 deletion hypothesis-python/src/hypothesis/extra/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import Any, Mapping, Optional, Sequence, Tuple, TypeVar, Union

import numpy as np
from numpy.typing import DTypeLike, NDArray

from hypothesis import strategies as st
from hypothesis._settings import note_deprecation
Expand All @@ -37,7 +38,6 @@
from hypothesis.strategies._internal.numbers import Real
from hypothesis.strategies._internal.strategies import T, check_strategy
from hypothesis.strategies._internal.utils import defines_strategy
from numpy.typing import DTypeLike, NDArray

__all__ = [
"BroadcastableShapes",
Expand Down Expand Up @@ -464,6 +464,7 @@ def arrays(
)
# From here on, we're only dealing with values and it's relatively simple.
dtype = np.dtype(dtype)
assert isinstance(dtype, np.dtype) # help mypy out a bit...
if elements is None or isinstance(elements, Mapping):
if dtype.kind in ("m", "M") and "[" not in dtype.str:
# For datetime and timedelta dtypes, we have a tricky situation -
Expand Down

0 comments on commit 1c7cd4d

Please sign in to comment.