@@ -19,9 +19,9 @@ def wrapper(child_func):
19
19
for line in parent_func .__doc__ .splitlines ():
20
20
if parameter in line :
21
21
match = re .search (rf"(\s*){ parameter } " , line )
22
- assert (
23
- match is not None
24
- ), f"Parameter { parameter } not found in the docstring of { parent_func . __name__ } "
22
+ assert match is not None , (
23
+ f"Parameter { parameter } not found in the docstring of { parent_func . __name__ } "
24
+ )
25
25
indent_parent = match .group (1 )
26
26
27
27
# The first line should be without the indentation because it will be placed at the correct location
@@ -32,15 +32,15 @@ def wrapper(child_func):
32
32
# Next parameter starts, stop copying lines
33
33
break
34
34
matching_lines .append (line )
35
- assert (
36
- len ( matching_lines ) > 0
37
- ), f"Could not extract the parameter { parameter } from the docstring of { parent_func . __name__ } "
35
+ assert len ( matching_lines ) > 0 , (
36
+ f"Could not extract the parameter { parameter } from the docstring of { parent_func . __name__ } "
37
+ )
38
38
39
39
# Replace the indentation of the parent with the indentation used in the child function
40
40
match = re .search (rf"([ \t]+){ parameter } " , child_func .__doc__ )
41
- assert (
42
- match is not None
43
- ), f"Parameter { parameter } not found in the docstring of { child_func . __name__ } "
41
+ assert match is not None , (
42
+ f"Parameter { parameter } not found in the docstring of { child_func . __name__ } "
43
+ )
44
44
indent_child = match .group (1 )
45
45
46
46
# First line contains the parameter name itself which should not be indented
@@ -53,9 +53,9 @@ def wrapper(child_func):
53
53
if replacements is not None :
54
54
for regex , repl in replacements .items ():
55
55
new_doc = re .sub (regex , repl , child_func .__doc__ )
56
- assert (
57
- new_doc != child_func .__doc__
58
- ), f"The replacement rule { regex } : { repl } did not change the docstring of { child_func . __name__ } "
56
+ assert new_doc != child_func . __doc__ , (
57
+ f"The replacement rule { regex } : { repl } did not change the docstring of { child_func .__name__ } "
58
+ )
59
59
child_func .__doc__ = new_doc
60
60
61
61
return child_func
0 commit comments