File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/tox/tox_env/python/virtual_env Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 55import re
66import sys
77from dataclasses import dataclass , field
8+ from typing import Final
89
9- if sys .version_info >= (3 , 11 ):
10+ if sys .version_info >= (3 , 11 ): # pragma: >=3.11 cover
1011 import tomllib
11- else :
12+ else : # pragma: <3.11 cover
1213 import tomli as tomllib
1314
1415
15- SCRIPT_METADATA_RE = re .compile (
16- r"(?m)^# /// (?P<type>[a-zA-Z0-9-]+)$\s(?P<content>(^#(| .*)$\s)+)^# ///$" ,
16+ SCRIPT_METADATA_RE : Final = re .compile (
17+ r"""
18+ (?m)
19+ ^[#][ ]///[ ](?P<type>[a-zA-Z0-9-]+)$ # opening: # /// <type>
20+ \s # blank line or whitespace
21+ (?P<content> # TOML content lines:
22+ (?:^[#](?:| .*)$\s)+ # each line starts with # (optionally followed by space + text)
23+ )
24+ ^[#][ ]///$ # closing: # ///
25+ """ ,
26+ re .VERBOSE ,
1727)
1828
1929
You can’t perform that action at this time.
0 commit comments