MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / compile

Function compile

tools/python-3.11.9-amd64/Lib/re/_compiler.py:740–765  ·  view source on GitHub ↗
(p, flags=0)

Source from the content-addressed store, hash-verified

738
739
740def compile(p, flags=0):
741 # internal: convert pattern list to internal format
742
743 if isstring(p):
744 pattern = p
745 p = _parser.parse(p, flags)
746 else:
747 pattern = None
748
749 code = _code(p, flags)
750
751 if flags & SRE_FLAG_DEBUG:
752 print()
753 dis(code)
754
755 # map in either direction
756 groupindex = p.state.groupdict
757 indexgroup = [None] * p.state.groups
758 for k, i in groupindex.items():
759 indexgroup[i] = k
760
761 return _sre.compile(
762 pattern, flags | p.state.flags, code,
763 p.state.groups-1,
764 groupindex, tuple(indexgroup)
765 )

Callers

nothing calls this directly

Calls 8

isstringFunction · 0.85
_codeFunction · 0.85
tupleClass · 0.85
disFunction · 0.70
printFunction · 0.50
parseMethod · 0.45
itemsMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected