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

Class TokenInfo

Lib/tokenize.py:47–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45del token
46
47class TokenInfo(collections.namedtuple('TokenInfo', 'type string start end line')):
48 def __repr__(self):
49 annotated_type = '%d (%s)' % (self.type, tok_name[self.type])
50 return ('TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r)' %
51 self._replace(type=annotated_type))
52
53 @property
54 def exact_type(self):
55 if self.type == OP and self.string in EXACT_TOKEN_TYPES:
56 return EXACT_TOKEN_TYPES[self.string]
57 else:
58 return self.type
59
60def group(*choices): return '(' + '|'.join(choices) + ')'
61def any(*choices): return group(*choices) + '*'

Callers 15

test_gatherMethod · 0.90
test_expr_grammarMethod · 0.90
test_optional_literalMethod · 0.90
test_repeat_0_simpleMethod · 0.90
test_repeat_0_complexMethod · 0.90
test_repeat_1_simpleMethod · 0.90
test_repeat_1_complexMethod · 0.90
test_left_recursiveMethod · 0.90

Calls

no outgoing calls

Tested by 14

test_gatherMethod · 0.72
test_expr_grammarMethod · 0.72
test_optional_literalMethod · 0.72
test_repeat_0_simpleMethod · 0.72
test_repeat_0_complexMethod · 0.72
test_repeat_1_simpleMethod · 0.72
test_repeat_1_complexMethod · 0.72
test_left_recursiveMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…