MCPcopy Index your code
hub / github.com/python/cpython / _CommentSpec

Class _CommentSpec

Lib/configparser.py:585–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583
584
585class _CommentSpec:
586 def __init__(self, full_prefixes, inline_prefixes):
587 full_patterns = (
588 # prefix at the beginning of a line
589 fr'^({re.escape(prefix)}).*'
590 for prefix in full_prefixes
591 )
592 inline_patterns = (
593 # prefix at the beginning of the line or following a space
594 fr'(^|\s)({re.escape(prefix)}.*)'
595 for prefix in inline_prefixes
596 )
597 self.pattern = re.compile('|'.join(itertools.chain(full_patterns, inline_patterns)))
598
599 def strip(self, text):
600 return self.pattern.sub('', text).rstrip()
601
602 def wrap(self, text):
603 return _Line(text, self)
604
605
606class RawConfigParser(MutableMapping):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…