@@ -136,12 +136,12 @@ def separate_def_list(test_str: str) -> list[str] | None:
136
136
137
137
Examples
138
138
--------
139
- >>> separate_def_list(" var1, var2, var3" )
140
- [" var1", " var2", " var3" ]
139
+ >>> separate_def_list(' var1, var2, var3' )
140
+ [' var1', ' var2', ' var3' ]
141
141
142
142
143
- >>> separate_def_list(" var, init_var(3) = [1,2,3], array(3,3)" )
144
- [" var", " init_var", " array" ]
143
+ >>> separate_def_list(' var, init_var(3) = [1,2,3], array(3,3)' )
144
+ [' var', ' init_var(3) = [1,2,3]', ' array(3,3)' ]
145
145
"""
146
146
stripped_str = strip_strings (test_str )
147
147
paren_count = 0
@@ -208,17 +208,17 @@ def find_paren_match(string: str) -> int:
208
208
209
209
Examples
210
210
--------
211
- >>> find_paren_match(" a, b)" )
211
+ >>> find_paren_match(' a, b)' )
212
212
4
213
213
214
214
Multiple parenthesis that are closed
215
215
216
- >>> find_paren_match(" a, (b, c), d)" )
216
+ >>> find_paren_match(' a, (b, c), d)' )
217
217
12
218
218
219
219
If the outermost parenthesis is not closed function returns -1
220
220
221
- >>> find_paren_match(" a, (b, (c, d)" )
221
+ >>> find_paren_match(' a, (b, (c, d)' )
222
222
-1
223
223
"""
224
224
paren_count = 1
@@ -401,12 +401,12 @@ def get_paren_substring(string: str) -> str | None:
401
401
402
402
Examples
403
403
--------
404
- >>> get_paren_substring(" some line(a, b, (c, d))" )
405
- " a, b, (c, d)"
404
+ >>> get_paren_substring(' some line(a, b, (c, d))' )
405
+ ' a, b, (c, d)'
406
406
407
407
If the line has incomplete parenthesis however, ``None`` is returned
408
- >>> get_paren_substring(" some line(a, b")
409
- None
408
+ >>> get_paren_substring(' some line(a, b') is None
409
+ True
410
410
"""
411
411
i1 = string .find ("(" )
412
412
i2 = string .rfind (")" )
@@ -432,13 +432,13 @@ def get_paren_level(line: str) -> tuple[str, list[Range]]:
432
432
433
433
Examples
434
434
--------
435
- >>> get_paren_level(" CALL sub1(arg1,arg2" )
435
+ >>> get_paren_level(' CALL sub1(arg1,arg2' )
436
436
('arg1,arg2', [Range(start=10, end=19)])
437
437
438
438
If the range is interrupted by parenthesis, another Range variable is used
439
439
to mark the ``start`` and ``end`` of the argument
440
440
441
- >>> get_paren_level(" CALL sub1(arg1(i),arg2" )
441
+ >>> get_paren_level(' CALL sub1(arg1(i),arg2' )
442
442
('arg1,arg2', [Range(start=10, end=14), Range(start=17, end=22)])
443
443
444
444
"""
@@ -493,16 +493,16 @@ def get_var_stack(line: str) -> list[str]:
493
493
494
494
Examples
495
495
--------
496
- >>> get_var_stack(" myvar%foo%bar" )
497
- [" myvar", " foo", " bar" ]
496
+ >>> get_var_stack(' myvar%foo%bar' )
497
+ [' myvar', ' foo', ' bar' ]
498
498
499
- >>> get_var_stack(" myarray(i)%foo%bar" )
500
- [" myarray", " foo", " bar" ]
499
+ >>> get_var_stack(' myarray(i)%foo%bar' )
500
+ [' myarray', ' foo', ' bar' ]
501
501
502
- In this case it will operate at the end of the string i.e. ``" this%foo" ``
502
+ In this case it will operate at the end of the string i.e. ``' this%foo' ``
503
503
504
- >>> get_var_stack(" CALL self%method(this%foo" )
505
- [" this", " foo" ]
504
+ >>> get_var_stack(' CALL self%method(this%foo' )
505
+ [' this', ' foo' ]
506
506
"""
507
507
if len (line ) == 0 :
508
508
return ["" ]
0 commit comments