#16478: merge with 3.2.

This commit is contained in:
Ezio Melotti 2012-11-16 13:17:42 +02:00
commit eb24b44ef4
1 changed files with 8 additions and 8 deletions

View File

@ -188,21 +188,21 @@ class Whitespace:
# count, il = self.norm # count, il = self.norm
# for i in range(len(count)): # for i in range(len(count)):
# if count[i]: # if count[i]:
# il = il + (i/tabsize + 1)*tabsize * count[i] # il = il + (i//tabsize + 1)*tabsize * count[i]
# return il # return il
# quicker: # quicker:
# il = trailing + sum (i/ts + 1)*ts*count[i] = # il = trailing + sum (i//ts + 1)*ts*count[i] =
# trailing + ts * sum (i/ts + 1)*count[i] = # trailing + ts * sum (i//ts + 1)*count[i] =
# trailing + ts * sum i/ts*count[i] + count[i] = # trailing + ts * sum i//ts*count[i] + count[i] =
# trailing + ts * [(sum i/ts*count[i]) + (sum count[i])] = # trailing + ts * [(sum i//ts*count[i]) + (sum count[i])] =
# trailing + ts * [(sum i/ts*count[i]) + num_tabs] # trailing + ts * [(sum i//ts*count[i]) + num_tabs]
# and note that i/ts*count[i] is 0 when i < ts # and note that i//ts*count[i] is 0 when i < ts
count, trailing = self.norm count, trailing = self.norm
il = 0 il = 0
for i in range(tabsize, len(count)): for i in range(tabsize, len(count)):
il = il + i/tabsize * count[i] il = il + i//tabsize * count[i]
return trailing + tabsize * (il + self.nt) return trailing + tabsize * (il + self.nt)
# return true iff self.indent_level(t) == other.indent_level(t) # return true iff self.indent_level(t) == other.indent_level(t)