Commit 9275b36
authored
Fix e.g. "re.PatternError: bad escape \s at position" error (#40)
## Summary
<!--AI:61d54311-->
Fixing the regular expression pattern error in the Python script by
adjusting the handling of escape sequences. This change resolves the
issue where the script would throw a `re.PatternError` due to incorrect
escape sequences like `\s` in regex patterns. The modification involves
using a lambda function to ensure that the replacement string in
`re.sub` calls is treated correctly, preventing the error from
occurring.
### Essential Code Lines
```python
new_body = re.sub(BODY_SUFFIX_RE, lambda _: suffix, body, flags=re.M | re.I | re.X)
```

## How was this tested?
```
python3 tests/test_ai.py
```
## PRs in the Stack
- ➡ #40
(The stack is managed by
[git-grok](https://github.com/dimikot/git-grok).)1 parent 701a0f1 commit 9275b36
3 files changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2052 | 2052 | | |
2053 | 2053 | | |
2054 | 2054 | | |
2055 | | - | |
2056 | | - | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
2057 | 2058 | | |
2058 | 2059 | | |
2059 | 2060 | | |
| |||
2065 | 2066 | | |
2066 | 2067 | | |
2067 | 2068 | | |
2068 | | - | |
| 2069 | + | |
2069 | 2070 | | |
2070 | 2071 | | |
2071 | 2072 | | |
| |||
2095 | 2096 | | |
2096 | 2097 | | |
2097 | 2098 | | |
2098 | | - | |
| 2099 | + | |
2099 | 2100 | | |
2100 | 2101 | | |
2101 | 2102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments