MCPcopy Index your code
hub / github.com/RustPython/RustPython / indent_level

Method indent_level

Lib/tabnanny.py:187–206  ·  view source on GitHub ↗
(self, tabsize)

Source from the content-addressed store, hash-verified

185 return max(len(count)-1, trailing)
186
187 def indent_level(self, tabsize):
188 # count, il = self.norm
189 # for i in range(len(count)):
190 # if count[i]:
191 # il = il + (i//tabsize + 1)*tabsize * count[i]
192 # return il
193
194 # quicker:
195 # il = trailing + sum (i//ts + 1)*ts*count[i] =
196 # trailing + ts * sum (i//ts + 1)*count[i] =
197 # trailing + ts * sum i//ts*count[i] + count[i] =
198 # trailing + ts * [(sum i//ts*count[i]) + (sum count[i])] =
199 # trailing + ts * [(sum i//ts*count[i]) + num_tabs]
200 # and note that i//ts*count[i] is 0 when i < ts
201
202 count, trailing = self.norm
203 il = 0
204 for i in range(tabsize, len(count)):
205 il = il + i//tabsize * count[i]
206 return trailing + tabsize * (il + self.nt)
207
208 # return true iff self.indent_level(t) == other.indent_level(t)
209 # for all t >= 1

Callers 3

not_equal_witnessMethod · 0.95
lessMethod · 0.95
not_less_witnessMethod · 0.95

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected