From 2d94bb3a6ec5d0e23175e9f98cd13e27cdf6954d Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 18 Jun 2024 02:08:02 -0700 Subject: [PATCH] _parse_docs: handle change to docstring indentation in Python 3.13 Signed-off-by: Adam Williamson --- skimage/measure/_regionprops.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/skimage/measure/_regionprops.py b/skimage/measure/_regionprops.py index 9f34d6a1c..3640d2c3b 100644 --- a/skimage/measure/_regionprops.py +++ b/skimage/measure/_regionprops.py @@ -1296,6 +1296,7 @@ def regionprops( A slice to extract the object from the source image. **solidity** : float Ratio of pixels in the region to pixels of the convex hull image. + *END OF LIST* (this line is here for regex parsing reasons) Each region also supports iteration, so that you can do:: @@ -1407,7 +1408,10 @@ def _parse_docs(): doc = regionprops.__doc__ or '' matches = re.finditer( - r'\*\*(\w+)\*\* \:.*?\n(.*?)(?=\n [\*\S]+)', doc, flags=re.DOTALL + # the fudging of the count of leading spaces on the description + # lines is because Python 3.13+ deindents docstrings: + # https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes + r'\*\*(\w+)\*\* \:.*?\n(.*?)(?=\n {0,4}\*+)', doc, flags=re.DOTALL ) prop_doc = {m.group(1): textwrap.dedent(m.group(2)) for m in matches} -- 2.45.2