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

Method getprog

Lib/idlelib/searchengine.py:75–90  ·  view source on GitHub ↗

Return compiled cooked search pattern.

(self)

Source from the content-addressed store, hash-verified

73 return pat
74
75 def getprog(self):
76 "Return compiled cooked search pattern."
77 pat = self.getpat()
78 if not pat:
79 self.report_error(pat, "Empty regular expression")
80 return None
81 pat = self.getcookedpat()
82 flags = 0
83 if not self.iscase():
84 flags = flags | re.IGNORECASE
85 try:
86 prog = re.compile(pat, flags)
87 except re.PatternError as e:
88 self.report_error(pat, e.msg, e.pos)
89 return None
90 return prog
91
92 def report_error(self, pat, msg, col=None):
93 # Derived class could override this with something fancier

Callers 8

search_textMethod · 0.95
default_commandMethod · 0.80
replace_allMethod · 0.80
do_findMethod · 0.80
do_replaceMethod · 0.80
default_commandMethod · 0.80
find_againMethod · 0.80
test_getprogMethod · 0.80

Calls 5

getpatMethod · 0.95
report_errorMethod · 0.95
getcookedpatMethod · 0.95
iscaseMethod · 0.95
compileMethod · 0.45

Tested by 1

test_getprogMethod · 0.64