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

Method tokenize

recipes/Python/464766_Trivia_Template/recipe-464766.py:43–55  ·  view source on GitHub ↗

tokenize(self) -> generator Split self into tokens and return generator object.

(self)

Source from the content-addressed store, hash-verified

41 return locals['_']
42
43 def tokenize(self):
44 """
45 tokenize(self) -> generator
46
47 Split self into tokens and return generator object.
48 """
49 for token in re.split('(<\?.*?\?>)', self):
50 if token.startswith('<?') and token.endswith('?>'):
51 yield token
52
53 else:
54 for ref in re.split('(###[\w_.]*)', token):
55 yield ref
56
57 def compile(self):
58 """

Callers 5

compileMethod · 0.95
formatMethod · 0.80
toProperFormulaFunction · 0.80
formatMethod · 0.80
formatMethod · 0.80

Calls 3

startswithMethod · 0.80
endswithMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected