11import os
22import re
3+ import sys
34
45import yaml
56
@@ -51,6 +52,11 @@ def _parse_docstring_parameters(doc_string, search_param_section=True):
5152
5253 str_list = doc_string .split ("\n " )
5354
55+ is_py313 = sys .version_info >= (3 , 13 )
56+ if is_py313 :
57+ # Add initial 4 spaces to all lines
58+ str_list = [f" { _ } " for _ in str_list ]
59+
5460 # Remove all spaces at the end of the strings (the should be no spaces there, but still)
5561 str_list = [s .rstrip () for s in str_list ]
5662
@@ -70,14 +76,15 @@ def _parse_docstring_parameters(doc_string, search_param_section=True):
7076
7177 assert (n_first is not None ) or (
7278 n_last is not None
73- ), "Incorrect docstring format: 'Parameters' or 'Return ' statement was not found in the docstring"
79+ ), "Incorrect docstring format: 'Parameters' or 'Returns ' statement was not found in the docstring"
7480
7581 # The list of strings contains parameter descriptions
7682 str_list = str_list [n_first : n_last + 1 ]
7783 # Each line must start with 4 spaces or be empty. Verify this
7884 assert all (
7985 [(not s ) or re .search (r"^ " , s ) for s in str_list ]
8086 ), "Incorrect docstring format: parameter descriptions should be indented by at least FOUR spaces"
87+
8188 # Now remove the spaces from nonempty lines
8289 str_list = [s [4 :] if s else s for s in str_list ]
8390
@@ -99,7 +106,7 @@ def _parse_docstring_parameters(doc_string, search_param_section=True):
99106 # The fist line of the description is actually the
100107 assert all (
101108 [len (s ) > 1 for s in param_descriptions ]
102- ), "Incomplete docstring: some parameters have not descriptions"
109+ ), "Incomplete docstring: some parameters have no descriptions"
103110
104111 params = list (zip (param_names , param_descriptions ))
105112
0 commit comments