Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
  • Loading branch information
reaganjlee and Zac-HD committed Apr 13, 2023
1 parent 784e5b5 commit 9f10ed3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RELEASE_TYPE: patch
RELEASE_TYPE: minor

This patch adds a codemod to convert deprecated Healthcheck.all()
into list(Healthcheck) as a part of issue #3596.
This release deprecates ``Healthcheck.all()``, and :ref:`adds a codemod <codemods>`
to automatically replace it with ``list(Healthcheck)`` (:issue:`3596`).
4 changes: 2 additions & 2 deletions hypothesis-python/src/hypothesis/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ def __repr__(self):
def all(cls) -> List["HealthCheck"]:
# Skipping of deprecated attributes is handled in HealthCheckMeta.__iter__
note_deprecation(
f"The Healthcheck.all() method is deprecated, instead opting for list(HealthCheck)",
since="2023-04-07",
f"`Healthcheck.all()` is deprecated; use `list(HealthCheck)` instead.",
since="RELEASEDAY",
has_codemod=True,
)
return list(HealthCheck)
Expand Down
9 changes: 3 additions & 6 deletions hypothesis-python/src/hypothesis/extra/codemods.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,7 @@ def leave_Call(self, original_node: cst.Call, updated_node: cst.Call) -> cst.Cal
updated_node.func,
m.Attribute(value=m.Name("Healthcheck"), attr=m.Name("all")),
):
new_node = cst.Call(
func=cst.Name("list"), args=[cst.Arg(value=cst.Name("Healthcheck"))]
return updated_node.with_changes(
func=cst.Name("list"),
args=[cst.Arg(value=cst.Name("Healthcheck"))],
)
updated_node = updated_node.with_changes(
func=new_node.func, args=new_node.args
)
return updated_node

0 comments on commit 9f10ed3

Please sign in to comment.