mirror of
https://github.com/ai-robots-txt/ai.robots.txt.git
synced 2025-04-09 13:27:46 +00:00
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:
parent
5b8650b99b
commit
6b0349f37d
1 changed files with 2 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue