Skip to content

Commit 3def0a6

Browse files
authored
Merge pull request #3722 from HypothesisWorks/create-pull-request/patch
Update pinned dependencies
2 parents e20023b + 2930fb2 commit 3def0a6

File tree

90 files changed

+380
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+380
-328
lines changed

hypothesis-python/RELEASE.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RELEASE_TYPE: patch
2+
3+
This patch enables and fixes many more of :pypi:`ruff`\ 's lint rules.

hypothesis-python/examples/test_binary_search.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,7 @@ def binary_search(ls, v):
7070

7171
def is_sorted(ls):
7272
"""Is this list sorted?"""
73-
for i in range(len(ls) - 1):
74-
if ls[i] > ls[i + 1]:
75-
return False
76-
return True
73+
return all(x <= y for x, y in zip(ls, ls[1:]))
7774

7875

7976
Values = st.integers()

hypothesis-python/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def local_file(name):
3737
warnings.warn(
3838
"This version of setuptools is too old to handle license_files "
3939
"metadata key. For more info, see: "
40-
"https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#metadata"
40+
"https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#metadata",
41+
stacklevel=1,
4142
)
4243

4344

hypothesis-python/src/_hypothesis_pytestplugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __call__(self, msg):
9191
Note that the pytest developers no longer support your version either!
9292
Disabling the Hypothesis pytest plugin...
9393
"""
94-
warnings.warn(PYTEST_TOO_OLD_MESSAGE % (pytest.__version__,))
94+
warnings.warn(PYTEST_TOO_OLD_MESSAGE % (pytest.__version__,), stacklevel=1)
9595

9696
else:
9797

hypothesis-python/src/hypothesis/_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def _define_setting(
231231
cls,
232232
name,
233233
description,
234+
*,
234235
default,
235236
options=None,
236237
validator=None,

hypothesis-python/src/hypothesis/control.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
def reject() -> NoReturn:
27-
raise UnsatisfiedAssumption()
27+
raise UnsatisfiedAssumption
2828

2929

3030
def assume(condition: object) -> bool:
@@ -35,7 +35,7 @@ def assume(condition: object) -> bool:
3535
true, and let Hypothesis try to avoid similar examples in future.
3636
"""
3737
if not condition:
38-
raise UnsatisfiedAssumption()
38+
raise UnsatisfiedAssumption
3939
return True
4040

4141

@@ -62,7 +62,7 @@ def current_build_context() -> "BuildContext":
6262

6363

6464
class BuildContext:
65-
def __init__(self, data, is_final=False, close_on_capture=True):
65+
def __init__(self, data, *, is_final=False, close_on_capture=True):
6666
assert isinstance(data, ConjectureData)
6767
self.data = data
6868
self.tasks = []

hypothesis-python/src/hypothesis/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ def __init__(self, test_runner, stuff, test, settings, random, wrapped_test):
694694
def execute_once(
695695
self,
696696
data,
697+
*,
697698
print_example=False,
698699
is_final=False,
699700
expected_failure=None,
@@ -1493,7 +1494,7 @@ def find(
14931494
def test(v):
14941495
if condition(v):
14951496
last[:] = [v]
1496-
raise Found()
1497+
raise Found
14971498

14981499
if random is not None:
14991500
test = seed(random.getrandbits(64))(test)

hypothesis-python/src/hypothesis/database.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def _db_for_path(path=None):
6161
path = storage_directory("examples")
6262
if not _usable_dir(path): # pragma: no cover
6363
warnings.warn(
64-
HypothesisWarning(
65-
"The database setting is not configured, and the default "
66-
"location is unusable - falling back to an in-memory "
67-
f"database for this session. {path=}"
68-
)
64+
"The database setting is not configured, and the default "
65+
"location is unusable - falling back to an in-memory "
66+
f"database for this session. {path=}",
67+
HypothesisWarning,
68+
stacklevel=3,
6969
)
7070
return InMemoryExampleDatabase()
7171
if path in (None, ":memory:"):
@@ -488,11 +488,11 @@ def _prepare_for_io(self) -> None:
488488
self._access_cache[keypath].add(PurePath(filename))
489489
except BadZipFile:
490490
warnings.warn(
491-
HypothesisWarning(
492-
"The downloaded artifact from GitHub is invalid. "
493-
"This could be because the artifact was corrupted, "
494-
"or because the artifact was not created by Hypothesis. "
495-
)
491+
"The downloaded artifact from GitHub is invalid. "
492+
"This could be because the artifact was corrupted, "
493+
"or because the artifact was not created by Hypothesis. ",
494+
HypothesisWarning,
495+
stacklevel=3,
496496
)
497497
self._disabled = True
498498

@@ -534,18 +534,17 @@ def _initialize_db(self) -> None:
534534
self._artifact = new_artifact
535535
elif found_artifact is not None:
536536
warnings.warn(
537-
HypothesisWarning(
538-
"Using an expired artifact as a fallback for the database: "
539-
f"{found_artifact}"
540-
)
537+
"Using an expired artifact as a fallback for the database: "
538+
f"{found_artifact}",
539+
HypothesisWarning,
540+
stacklevel=2,
541541
)
542542
self._artifact = found_artifact
543543
else:
544544
warnings.warn(
545-
HypothesisWarning(
546-
"Couldn't acquire a new or existing artifact. "
547-
"Disabling database."
548-
)
545+
"Couldn't acquire a new or existing artifact. Disabling database.",
546+
HypothesisWarning,
547+
stacklevel=2,
549548
)
550549
self._disabled = True
551550
return
@@ -587,7 +586,7 @@ def _get_bytes(self, url: str) -> Optional[bytes]: # pragma: no cover
587586
)
588587

589588
if warning_message is not None:
590-
warnings.warn(HypothesisWarning(warning_message))
589+
warnings.warn(warning_message, HypothesisWarning, stacklevel=4)
591590
return None
592591

593592
return response_bytes
@@ -624,7 +623,9 @@ def _fetch_artifact(self) -> Optional[Path]: # pragma: no cover
624623
f.write(artifact_bytes)
625624
except OSError:
626625
warnings.warn(
627-
HypothesisWarning("Could not save the latest artifact from GitHub. ")
626+
"Could not save the latest artifact from GitHub. ",
627+
HypothesisWarning,
628+
stacklevel=3,
628629
)
629630
return None
630631

hypothesis-python/src/hypothesis/executors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
def default_executor(function): # pragma: nocover
13-
raise NotImplementedError() # We don't actually use this any more
13+
raise NotImplementedError # We don't actually use this any more
1414

1515

1616
def setup_teardown_executor(setup, teardown):

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def broadcastable_shapes(
275275
# We are unsure if gufuncs allow frozen dimensions to be optional, but it's
276276
# easy enough to support here - and so we will unless we learn otherwise.
277277
_DIMENSION = r"\w+\??" # Note that \w permits digits too!
278-
_SHAPE = rf"\((?:{_DIMENSION}(?:,{_DIMENSION})" + r"{0,31})?\)"
278+
_SHAPE = rf"\((?:{_DIMENSION}(?:,{_DIMENSION}){{0,31}})?\)"
279279
_ARGUMENT_LIST = f"{_SHAPE}(?:,{_SHAPE})*"
280280
_SIGNATURE = rf"^{_ARGUMENT_LIST}->{_SHAPE}$"
281281
_SIGNATURE_MULTIPLE_OUTPUT = rf"^{_ARGUMENT_LIST}->{_ARGUMENT_LIST}$"
@@ -286,7 +286,7 @@ class _GUfuncSig(NamedTuple):
286286
result_shape: Shape
287287

288288

289-
def _hypothesis_parse_gufunc_signature(signature, all_checks=True):
289+
def _hypothesis_parse_gufunc_signature(signature, *, all_checks=True):
290290
# Disable all_checks to better match the Numpy version, for testing
291291
if not re.match(_SIGNATURE, signature):
292292
if re.match(_SIGNATURE_MULTIPLE_OUTPUT, signature):

0 commit comments

Comments
 (0)