From 60707443eaf4300352f9e227f91ea2f79ad7aeaf Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Fri, 15 Oct 2010 18:23:34 +0000 Subject: PEP8 cleanup: fix whitespace around operator Reviewed-by: James Cameron Acked-by: Simon Schampijer CC: Aleksey Lim --- diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py index d9dd96d..c0ea7dd 100644 --- a/src/sugar/activity/bundlebuilder.py +++ b/src/sugar/activity/bundlebuilder.py @@ -19,6 +19,7 @@ STABLE. """ +import operator import os import sys import zipfile @@ -84,7 +85,7 @@ class Config(object): self.version = bundle.get_activity_version() self.activity_name = bundle.get_bundle_name() self.bundle_id = bundle.get_bundle_id() - self.bundle_name = reduce(lambda x, y: x+y, self.activity_name.split()) + self.bundle_name = reduce(operator.add, self.activity_name.split()) self.bundle_root_dir = self.bundle_name + '.activity' self.tar_root_dir = '%s-%s' % (self.bundle_name, self.version) diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py index e7882b9..482b31b 100644 --- a/src/sugar/bundle/activitybundle.py +++ b/src/sugar/bundle/activitybundle.py @@ -336,7 +336,7 @@ class ActivityBundle(Bundle): # Is anything in MANIFEST left over after accounting for all files? if manifestfiles: - err = ("Bundle %s: files in MANIFEST not included: %s"% + err = ("Bundle %s: files in MANIFEST not included: %s" % (self._name, str(manifestfiles))) if strict_manifest: raise MalformedBundleException(err) diff --git a/src/sugar/graphics/alert.py b/src/sugar/graphics/alert.py index 0202a66..f032871 100644 --- a/src/sugar/graphics/alert.py +++ b/src/sugar/graphics/alert.py @@ -357,7 +357,7 @@ class _TimeoutIcon(hippo.CanvasText, hippo.CanvasItem): radius = min(width * 0.5, height * 0.5) hippo.cairo_set_source_rgba32(cr, self.props.background_color) - cr.arc(xval, yval, radius, 0, 2*math.pi) + cr.arc(xval, yval, radius, 0, 2 * math.pi) cr.fill_preserve() diff --git a/src/sugar/graphics/palettewindow.py b/src/sugar/graphics/palettewindow.py index e76e952..0250f4a 100644 --- a/src/sugar/graphics/palettewindow.py +++ b/src/sugar/graphics/palettewindow.py @@ -110,8 +110,8 @@ class MouseSpeedDetector(gobject.GObject): (x, y) = self._get_mouse_position() self._mouse_pos = (x, y) - dist2 = (oldx - x)**2 + (oldy - y)**2 - if dist2 > self._threshold**2: + dist2 = (oldx - x) ** 2 + (oldy - y) ** 2 + if dist2 > self._threshold ** 2: return True else: return False diff --git a/src/sugar/network.py b/src/sugar/network.py index b72acad..069a980 100644 --- a/src/sugar/network.py +++ b/src/sugar/network.py @@ -250,11 +250,11 @@ class GlibURLDownloader(gobject.GObject): fidx = data.find(ftag) if fidx < 0: return None - fname = data[fidx+len(ftag):] + fname = data[fidx + len(ftag):] if fname[0] == '"' or fname[0] == "'": fname = fname[1:] - if fname[len(fname)-1] == '"' or fname[len(fname)-1] == "'": - fname = fname[:len(fname)-1] + if fname[len(fname) - 1] == '"' or fname[len(fname) - 1] == "'": + fname = fname[:len(fname) - 1] return fname def _read_next_chunk(self, source, condition): diff --git a/src/sugar/util.py b/src/sugar/util.py index 3625f21..e1bcf88 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -346,9 +346,9 @@ def format_size(size): return _('Empty') elif size < 1024: return _('%d B') % size - elif size < 1024**2: + elif size < 1024 ** 2: return _('%d KB') % (size / 1024) - elif size < 1024**3: - return _('%d MB') % (size / 1024**2) + elif size < 1024 ** 3: + return _('%d MB') % (size / 1024 ** 2) else: - return _('%d GB') % (size / 1024**3) + return _('%d GB') % (size / 1024 ** 3) -- cgit v0.9.1