| | |
- NannyNag
- Whitespace
class Whitespace |
| |
|
| |
Methods defined here:
- __init__(self, ws)
- equal(self, other)
- # return true iff indent_level(t) == other.indent_level(t)
# for all t >= 1
- indent_level(self, tabsize)
- less(self, other)
- # Return true iff indent_level(t) < other.indent_level(t)
# for all t >= 1.
# The algorithm is due to Vincent Broman.
# Easy to prove it's correct.
# XXXpost that.
# Trivial to prove n is sharp (consider T vs ST).
# Unknown whether there's a faster general way. I suspected so at
# first, but no longer.
# For the special (but common!) case where M and N are both of the
# form (T*)(S*), M.less(N) iff M.len() < N.len() and
# M.num_tabs() <= N.num_tabs(). Proof is easy but kinda long-winded.
# XXXwrite that up.
# Note that M is of the form (T*)(S*) iff len(M.norm[0]) <= 1.
- longest_run_of_spaces(self)
- # return length of longest contiguous run of spaces (whether or not
# preceding a tab)
- not_equal_witness(self, other)
- # return a list of tuples (ts, i1, i2) such that
# i1 == indent_level(ts) != other.indent_level(ts) == i2.
# Intended to be used after not equal(other) is known, in which
# case it will return at least one witnessing tab size.
- not_less_witness(self, other)
- # return a list of tuples (ts, i1, i2) such that
# i1 == indent_level(ts) >= other.indent_level(ts) == i2.
# Intended to be used after not less(other) is known, in which
# case it will return at least one witnessing tab size.
Data and non-method functions defined here:
- S = ' '
- T = '\t'
- __doc__ = None
- __module__ = 'tabnanny'
| |