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

Method indent_level

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

Source from the content-addressed store, hash-verified

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

Callers 3

not_equal_witnessMethod · 0.95
lessMethod · 0.95
not_less_witnessMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected