def _compile_patterns(self):
"""
Compiles the regexes based on the original implementation of the parser (``InventoryParser``)
and sets the to ``self.patterns``
"""
self.patterns['section'] = re.compile(
r'''^\[
([^:\]\s]+) # group name
(?::(\w+))? # optional tag name :
\]
\s* # ignore trailing whitespace
(?:\#.*)? # and/or a comment till the
$ # end of the line
''', re.X
)
self.patterns['groupname'] = re.compile(
r'''^
([^:\]\s]+)
\s* # ignore trailing whitespace
(?:\#.*)? # and/or a comment till the
$ # end of the line
''', re.X
)
评论列表
文章目录