[pypy-commit] pyrepl codecheck-clean: clean up the mini curses and the completing reader

RonnyPfannschmidt noreply at buildbot.pypy.org
Mon Feb 25 09:20:19 CET 2013


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: codecheck-clean
Changeset: r235:84dcd5060600
Date: 2013-02-25 08:28 +0100
http://bitbucket.org/pypy/pyrepl/changeset/84dcd5060600/

Log:	clean up the mini curses and the completing reader

diff --git a/pyrepl/completing_reader.py b/pyrepl/completing_reader.py
--- a/pyrepl/completing_reader.py
+++ b/pyrepl/completing_reader.py
@@ -55,7 +55,7 @@
         # too bad, we remove the color
         return stripped[:maxlen]
     padding = maxlen - len(stripped)
-    return s + ' '*padding
+    return s + ' ' * padding
 
 
 def build_menu(cons, wordlist, start, use_brackets, sort_in_column):
@@ -67,7 +67,7 @@
         padding = 2
     maxlen = min(max(map(real_len, wordlist)), cons.width - padding)
     cols = cons.width / (maxlen + padding)
-    rows = (len(wordlist) - 1)/cols + 1
+    rows = (len(wordlist) - 1) / cols + 1
 
     if sort_in_column:
         # sort_in_column=False (default)     sort_in_column=True
@@ -77,8 +77,8 @@
         #
         # "fill" the table with empty words, so we always have the same amout
         # of rows for each column
-        missing = cols*rows - len(wordlist)
-        wordlist = wordlist + ['']*missing
+        missing = cols * rows - len(wordlist)
+        wordlist = wordlist + [''] * missing
         indexes = [(i % cols) * rows + i // cols for i in range(len(wordlist))]
         wordlist = [wordlist[i] for i in indexes]
     menu = []
@@ -238,7 +238,7 @@
         if self.cmpltn_menu_vis:
             ly = self.lxy[1]
             screen[ly:ly] = self.cmpltn_menu
-            self.screeninfo[ly:ly] = [(0, [])]*len(self.cmpltn_menu)
+            self.screeninfo[ly:ly] = [(0, [])] * len(self.cmpltn_menu)
             self.cxy = self.cxy[0], self.cxy[1] + len(self.cmpltn_menu)
         return screen
 
@@ -259,7 +259,7 @@
         p = self.pos - 1
         while p >= 0 and st.get(b[p], SW) == SW:
             p -= 1
-        return ''.join(b[p+1:self.pos])
+        return ''.join(b[p + 1:self.pos])
 
     def get_completions(self, stem):
         return []
diff --git a/pyrepl/curses.py b/pyrepl/curses.py
--- a/pyrepl/curses.py
+++ b/pyrepl/curses.py
@@ -19,5 +19,5 @@
 # CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-
+__all__ = ['setupterm', 'tigetstr', 'tparm', 'error']
 from ._minimal_curses import setupterm, tigetstr, tparm, error


More information about the pypy-commit mailing list