Author: Alex Gaynor <[email protected]>
Branch: 
Changeset: r63854:f6d1a5b22c1f
Date: 2013-05-04 21:30 -0700
http://bitbucket.org/pypy/pypy/changeset/f6d1a5b22c1f/

Log:    some random pep8 cleanups

diff --git a/pypy/objspace/std/stringobject.py 
b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -39,12 +39,10 @@
 
     def unicode_w(w_self, space):
         # Use the default encoding.
-        from pypy.objspace.std.unicodetype import unicode_from_string, \
-                decode_object
+        from pypy.objspace.std.unicodetype import (unicode_from_string,
+            decode_object, _get_encoding_and_errors)
         w_defaultencoding = space.call_function(space.sys.get(
                                                 'getdefaultencoding'))
-        from pypy.objspace.std.unicodetype import _get_encoding_and_errors, \
-            unicode_from_string, decode_object
         encoding, errors = _get_encoding_and_errors(space, w_defaultencoding,
                                                     space.w_None)
         if encoding is None and errors is None:
@@ -236,7 +234,7 @@
 def str_title__String(space, w_self):
     input = w_self._value
     builder = StringBuilder(len(input))
-    prev_letter=' '
+    prev_letter = ' '
 
     for pos in range(len(input)):
         ch = input[pos]
@@ -434,7 +432,7 @@
             space.wrap("rjust() argument 2 must be a single character"))
 
     d = u_arg - len(u_self)
-    if d>0:
+    if d > 0:
         fillchar = fillchar[0]    # annotator hint: it's a single character
         u_self = d * fillchar + u_self
 
@@ -450,7 +448,7 @@
             space.wrap("ljust() argument 2 must be a single character"))
 
     d = u_arg - len(u_self)
-    if d>0:
+    if d > 0:
         fillchar = fillchar[0]    # annotator hint: it's a single character
         u_self += d * fillchar
 
@@ -471,12 +469,12 @@
     return space.newbool(self.find(sub) >= 0)
 
 def str_find__String_String_ANY_ANY(space, w_self, w_sub, w_start, w_end):
-    (self, start, end) =  _convert_idx_params(space, w_self, w_start, w_end)
+    (self, start, end) = _convert_idx_params(space, w_self, w_start, w_end)
     res = self.find(w_sub._value, start, end)
     return space.wrap(res)
 
 def str_rfind__String_String_ANY_ANY(space, w_self, w_sub, w_start, w_end):
-    (self, start, end) =  _convert_idx_params(space, w_self, w_start, w_end)
+    (self, start, end) = _convert_idx_params(space, w_self, w_start, w_end)
     res = self.rfind(w_sub._value, start, end)
     return space.wrap(res)
 
@@ -511,7 +509,7 @@
 
 
 def str_index__String_String_ANY_ANY(space, w_self, w_sub, w_start, w_end):
-    (self, start, end) =  _convert_idx_params(space, w_self, w_start, w_end)
+    (self, start, end) = _convert_idx_params(space, w_self, w_start, w_end)
     res = self.find(w_sub._value, start, end)
     if res < 0:
         raise OperationError(space.w_ValueError,
@@ -521,7 +519,7 @@
 
 
 def str_rindex__String_String_ANY_ANY(space, w_self, w_sub, w_start, w_end):
-    (self, start, end) =  _convert_idx_params(space, w_self, w_start, w_end)
+    (self, start, end) = _convert_idx_params(space, w_self, w_start, w_end)
     res = self.rfind(w_sub._value, start, end)
     if res < 0:
         raise OperationError(space.w_ValueError,
@@ -728,7 +726,7 @@
         while 1:
             #no sophisticated linebreak support now, '\r' just for passing 
adapted CPython test
             if u_token[offset-1] == "\n" or u_token[offset-1] == "\r":
-                break;
+                break
             distance += 1
             offset -= 1
             if offset == 0:
@@ -738,7 +736,7 @@
         #print '<offset:%d distance:%d tabsize:%d token:%s>' % (offset, 
distance, u_tabsize, u_token)
         distance = (u_tabsize-distance) % u_tabsize
         if distance == 0:
-            distance=u_tabsize
+            distance = u_tabsize
 
     return distance
 
@@ -760,14 +758,14 @@
 
         for token in split:
             #print  "%d#%d -%s-" % (_tabindent(oldtoken,u_tabsize), u_tabsize, 
token)
-            u_expanded += " " * _tabindent(oldtoken,u_tabsize) + token
+            u_expanded += " " * _tabindent(oldtoken, u_tabsize) + token
             oldtoken = token
 
     return wrapstr(space, u_expanded)
 
 
 def str_splitlines__String_ANY(space, w_self, w_keepends):
-    u_keepends  = space.int_w(w_keepends)  # truth value, but type checked
+    u_keepends = space.int_w(w_keepends)  # truth value, but type checked
     data = w_self._value
     selflen = len(data)
     strs_w = []
@@ -876,7 +874,6 @@
     return wrapchar(space, str[ival])
 
 def getitem__String_Slice(space, w_str, w_slice):
-    w = space.wrap
     s = w_str._value
     length = len(s)
     start, stop, step, sl = w_slice.indices4(space, length)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to