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

Method set_index

Lib/idlelib/hyperparser.py:81–100  ·  view source on GitHub ↗

Set the index to which the functions relate. The index must be in the same statement.

(self, index)

Source from the content-addressed store, hash-verified

79 self.set_index(index)
80
81 def set_index(self, index):
82 """Set the index to which the functions relate.
83
84 The index must be in the same statement.
85 """
86 indexinrawtext = (len(self.rawtext) -
87 len(self.text.get(index, self.stopatindex)))
88 if indexinrawtext < 0:
89 raise ValueError("Index %s precedes the analyzed statement"
90 % index)
91 self.indexinrawtext = indexinrawtext
92 # find the rightmost bracket to which index belongs
93 self.indexbracket = 0
94 while (self.indexbracket < len(self.bracketing)-1 and
95 self.bracketing[self.indexbracket+1][0] < self.indexinrawtext):
96 self.indexbracket += 1
97 if (self.indexbracket < len(self.bracketing)-1 and
98 self.bracketing[self.indexbracket+1][0] == self.indexinrawtext and
99 not self.isopener[self.indexbracket+1]):
100 self.indexbracket += 1
101
102 def is_in_string(self):
103 """Is the index given to the HyperParser in a string?"""

Callers 3

__init__Method · 0.95
open_calltipMethod · 0.95
open_completionsMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected