|
42 | 42 | continue
|
43 | 43 |
|
44 | 44 | # Work around a bug in Red Baron, which indents docstrings too much when you insert them, so we have to un-indent it one level first
|
45 |
| - correct_async_docstring = re.sub('^ ', '', correct_async_docstring, flags=re.M) |
| 45 | + correct_async_docstring = re.sub('^ ', '', correct_async_docstring, flags=re.MULTILINE) |
46 | 46 |
|
47 | 47 | if not isinstance(async_docstring, str):
|
48 | 48 | print(f'Fixing missing docstring for "{async_class.name}.{async_method.name}"...')
|
|
54 | 54 |
|
55 | 55 | # Work around a bug in Red Baron, which adds indents to docstrings when you insert them (including empty lines),
|
56 | 56 | # so we have to remove the extra whitespace
|
57 |
| - updated_source_code = re.sub('^ $', '', updated_source_code, flags=re.M) |
| 57 | + updated_source_code = re.sub('^ $', '', updated_source_code, flags=re.MULTILINE) |
58 | 58 |
|
59 | 59 | # Work around a bug in Red Baron, which indents `except` and `finally` statements wrong
|
60 | 60 | # so we have to add some extra whitespace
|
61 |
| - updated_source_code = re.sub('^except', ' except', updated_source_code, flags=re.M) |
62 |
| - updated_source_code = re.sub('^ except', ' except', updated_source_code, flags=re.M) |
63 |
| - updated_source_code = re.sub('^finally', ' finally', updated_source_code, flags=re.M) |
64 |
| - updated_source_code = re.sub('^ finally', ' finally', updated_source_code, flags=re.M) |
| 61 | + updated_source_code = re.sub('^except', ' except', updated_source_code, flags=re.MULTILINE) |
| 62 | + updated_source_code = re.sub('^ except', ' except', updated_source_code, flags=re.MULTILINE) |
| 63 | + updated_source_code = re.sub('^finally', ' finally', updated_source_code, flags=re.MULTILINE) |
| 64 | + updated_source_code = re.sub('^ finally', ' finally', updated_source_code, flags=re.MULTILINE) |
65 | 65 |
|
66 | 66 | # Work around a bug in Red Baron, which sometimes adds an extra new line to the end of a file
|
67 | 67 | updated_source_code = updated_source_code.rstrip() + '\n'
|
|
0 commit comments