fix python complaining about f-string syntax

```
python code/tests.py
Traceback (most recent call last):
  File "/Users/fbarthelemy/Code/ai.robots.txt/code/tests.py", line 7, in <module>
    from robots import json_to_txt, json_to_table, json_to_htaccess, json_to_nginx
  File "/Users/fbarthelemy/Code/ai.robots.txt/code/robots.py", line 144
    return f"({"|".join(map(re.escape, lst))})"
                ^
SyntaxError: f-string: expecting '}'
```
This commit is contained in:
Frederic Barthelemy 2025-04-04 15:20:30 -07:00
parent 5b8650b99b
commit 6b0349f37d
No known key found for this signature in database
GPG key ID: 6FF43C49A5D473EF

View file

@ -141,7 +141,8 @@ def json_to_table(robots_json):
def list_to_pcre(lst):
# Python re is not 100% identical to PCRE which is used by Apache, but it
# should probably be close enough in the real world for re.escape to work.
return f"({"|".join(map(re.escape, lst))})"
formatted = "|".join(map(re.escape, lst))
return f"({formatted})"
def json_to_htaccess(robot_json):