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

Function compile

Lib/re/_compiler.py:757–782  ·  view source on GitHub ↗
(p, flags=0)

Source from the content-addressed store, hash-verified

755
756
757def compile(p, flags=0):
758 # internal: convert pattern list to internal format
759
760 if isstring(p):
761 pattern = p
762 p = _parser.parse(p, flags)
763 else:
764 pattern = None
765
766 code = _code(p, flags)
767
768 if flags & SRE_FLAG_DEBUG:
769 print()
770 dis(code)
771
772 # map in either direction
773 groupindex = p.state.groupdict
774 indexgroup = [None] * p.state.groups
775 for k, i in groupindex.items():
776 indexgroup[i] = k
777
778 return _sre.compile(
779 pattern, flags | p.state.flags, code,
780 p.state.groups-1,
781 groupindex, tuple(indexgroup)
782 )

Callers

nothing calls this directly

Calls 6

isstringFunction · 0.85
_codeFunction · 0.85
disFunction · 0.70
parseMethod · 0.45
itemsMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…