eric6/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py

changeset 7249
0bf517e60f54
parent 6942
2602857055c5
child 7256
4ef3b78ebb4e
equal deleted inserted replaced
7248:60b48ab891fa 7249:0bf517e60f54
329 Public method to determine the indentation level. 329 Public method to determine the indentation level.
330 330
331 @param tabsize The length of a tab stop. (integer) 331 @param tabsize The length of a tab stop. (integer)
332 @return indentation level (integer) 332 @return indentation level (integer)
333 """ 333 """
334 # count, il = self.norm 334 ## count, il = self.norm
335 # for i in range(len(count)): 335 ## for i in range(len(count)):
336 # if count[i]: 336 ## if count[i]:
337 # il = il + (i/tabsize + 1)*tabsize * count[i] 337 ## il = il + (i/tabsize + 1)*tabsize * count[i]
338 # return il 338 ## return il
339 339
340 # quicker: 340 ## quicker:
341 # il = trailing + sum (i/ts + 1)*ts*count[i] = 341 ## il = trailing + sum (i/ts + 1)*ts*count[i] =
342 # trailing + ts * sum (i/ts + 1)*count[i] = 342 ## trailing + ts * sum (i/ts + 1)*count[i] =
343 # trailing + ts * sum i/ts*count[i] + count[i] = 343 ## trailing + ts * sum i/ts*count[i] + count[i] =
344 # trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] = 344 ## trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] =
345 # trailing + ts * [(sum i/ts*count[i]) + num_tabs] 345 ## trailing + ts * [(sum i/ts*count[i]) + num_tabs]
346 # and note that i/ts*count[i] is 0 when i < ts 346 ## and note that i/ts*count[i] is 0 when i < ts
347 347
348 count, trailing = self.norm 348 count, trailing = self.norm
349 il = 0 349 il = 0
350 for i in range(tabsize, len(count)): 350 for i in range(tabsize, len(count)):
351 il = il + i / tabsize * count[i] 351 il = il + i / tabsize * count[i]

eric ide

mercurial