add Python version comment
This commit is contained in:
parent
9c11dd65ff
commit
0547cd6c58
@ -54,17 +54,16 @@ def build_pattern(ranges):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Build the regex pattern and write it to
|
"""Build the regex pattern and write it to ``jinja2/_identifier.py``."""
|
||||||
``jinja2/_identifier.py``.
|
|
||||||
"""
|
|
||||||
pattern = build_pattern(collapse_ranges(get_characters()))
|
pattern = build_pattern(collapse_ranges(get_characters()))
|
||||||
filename = os.path.abspath(
|
filename = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__), "..", "src", "jinja2", "_identifier.py")
|
os.path.join(os.path.dirname(__file__), "..", "src", "jinja2", "_identifier.py")
|
||||||
)
|
)
|
||||||
|
|
||||||
with open(filename, "w", encoding="utf8") as f:
|
with open(filename, "w", encoding="utf8") as f:
|
||||||
|
f.write("# generated by scripts/generate_identifier_pattern.py")
|
||||||
|
f.write(f"# Python {sys.version_info[0]}.{sys.version_info[1]}\n")
|
||||||
f.write("import re\n\n")
|
f.write("import re\n\n")
|
||||||
f.write("# generated by scripts/generate_identifier_pattern.py\n")
|
|
||||||
f.write("pattern = re.compile(\n")
|
f.write("pattern = re.compile(\n")
|
||||||
f.write(f' r"[\\w{pattern}]+" # noqa: B950\n')
|
f.write(f' r"[\\w{pattern}]+" # noqa: B950\n')
|
||||||
f.write(")\n")
|
f.write(")\n")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user