MCPcopy Create free account
hub / github.com/ActiveState/code / replace

Method replace

recipes/Python/146460_HTML_Templates/recipe-146460.py:27–35  ·  view source on GitHub ↗

The replacement method. This is passed a match object by re.sub(), which it uses to index the replacement dictionary and find the replacement string.

(self, matchobj)

Source from the content-addressed store, hash-verified

25 self.dict = dict
26
27 def replace(self, matchobj):
28 """The replacement method. This is passed a match object by re.sub(),
29 which it uses to index the replacement dictionary and find the
30 replacement string."""
31 key = matchobj.group(1)
32 if self.dict.has_key(key):
33 return self.dict[key]
34 else:
35 return ''
36
37class OpagCGI:
38 """This class represents a running instance of a CGI on the OPAG website.

Callers 15

recipe-577489.jsFile · 0.45
slugifyFunction · 0.45
NamespaceFunction · 0.45
recipe-576839.jsFile · 0.45
recipe-577193.jsFile · 0.45
recipe-578597.jsFile · 0.45
recipe-578769.jsFile · 0.45
quicklogFunction · 0.45
checkEmailFunction · 0.45
escapeHtmlEntitiesFunction · 0.45
replaceAllFunction · 0.45

Calls 2

groupMethod · 0.45
has_keyMethod · 0.45

Tested by

no test coverage detected