mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Make the regex pattern easier to read, understand, and modify
by factoring out the common prefix (the delimiter).
This commit is contained in:
parent
4d9559a47e
commit
55593c3ef5
1 changed files with 6 additions and 4 deletions
|
@ -101,10 +101,12 @@ class _multimap:
|
|||
|
||||
class _TemplateMetaclass(type):
|
||||
pattern = r"""
|
||||
(?P<escaped>%(delim)s{2}) | # Escape sequence of two delimiters
|
||||
%(delim)s(?P<named>%(id)s) | # delimiter and a Python identifier
|
||||
%(delim)s{(?P<braced>%(id)s)} | # delimiter and a braced identifier
|
||||
(?P<invalid>%(delim)s) # Other ill-formed delimiter exprs
|
||||
%(delim)s(?:
|
||||
(?P<escaped>%(delim)s) | # Escape sequence of two delimiters
|
||||
(?P<named>%(id)s) | # delimiter and a Python identifier
|
||||
{(?P<braced>%(id)s)} | # delimiter and a braced identifier
|
||||
(?P<invalid>) # Other ill-formed delimiter exprs
|
||||
)
|
||||
"""
|
||||
|
||||
def __init__(cls, name, bases, dct):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue