summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-07 09:15:58 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-07 09:18:20 +0200
commit8de05809108aef5adbc9081975f530344c8bce62 (patch)
tree2c61a70b40846cd39b82030213debf3519817eef
parent03f199881df7ede128a6d41e32af0b935fd013f1 (diff)
Turn remove_while() into remove_blank().
This is the only way it's used. Maybe it ought to be removed completely.
-rw-r--r--kconfiglib.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 9067768..ed1d50c 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -1145,9 +1145,10 @@ class Config(object):
depends_on_expr = _make_and(depends_on_expr, parsed_deps)
elif t0 == T_HELP:
- # Find first non-empty line and get its indentation
+ # Find first non-blank (not all-space) line and get its
+ # indentation
- line_feeder.remove_while(str.isspace)
+ line_feeder.remove_blank()
line = line_feeder.get_next()
if line is None:
stmt.help = ""
@@ -3506,10 +3507,6 @@ class _Feed(object):
return True
return False
- def remove_while(self, pred):
- while self.i < self.length and pred(self.items[self.i]):
- self.i += 1
-
def go_back(self):
if self.i <= 0:
_internal_error("Attempt to move back in Feed while already at the beginning.")
@@ -3531,6 +3528,11 @@ class _FileFeed(_Feed):
self.filename = _clean_up_path(filename)
_Feed.__init__(self, _get_lines(filename))
+ def remove_blank(self):
+ """Removes lines until the first non-blank (not all-space) line."""
+ while self.i < self.length and self.items[self.i].isspace():
+ self.i += 1
+
def get_filename(self):
return self.filename