Commits

Dobrosław Żybort committed cebb923

Fix: pep8 E225 missing whitespace around operator

Comments (0)

Files changed (7)

lazygal/eyecandy.py

         self.bg = bg != 'transparent' and bg or Color.TRANSPARENT
 
         self.result_size = result_size
-        self.thumb_size = [3*max(self.result_size)//5 for i in range(2)]
+        self.thumb_size = [3 * max(self.result_size) // 5 for i in range(2)]
 
         self.picture_mess = None
 
         img = Image.open(image_path)
         img.thumbnail(self.thumb_size, Image.ANTIALIAS)
 
-        white_size = [ x + 2*self.THUMB_WHITE_WIDTH for x in img.size ]
+        white_size = [ x + 2 * self.THUMB_WHITE_WIDTH for x in img.size ]
 
         white = Image.new('RGB', white_size, 'white')
         white.paste(img, (self.THUMB_WHITE_WIDTH, self.THUMB_WHITE_WIDTH))
 
-        maxi = 2*max(white_size)
+        maxi = 2 * max(white_size)
 
         thumb = Image.new('RGBA', (maxi, maxi))
 
-        thumb.paste(white, ((maxi - white_size[0])// 2,
-                            (maxi - white_size[1])// 2))
+        thumb.paste(white, ((maxi - white_size[0]) // 2,
+                            (maxi - white_size[1]) // 2))
 
         rotation = random.randint(-self.THUMB_MAX_ROTATE_ANGLE,
                                   self.THUMB_MAX_ROTATE_ANGLE)

lazygal/genmedia.py

 from PIL import Image as PILImage
 # lazygal has her own ImageFile class, so avoid trouble
 from PIL import ImageFile as PILImageFile
-PILImageFile.MAXBLOCK = 1024*1024 # default is 64k, not enough for big pics
+PILImageFile.MAXBLOCK = 1024 * 1024 # default is 64k, not enough for big pics
 
 import make
 import genfile

lazygal/genpage.py

     def url_quote(self, url):
         return urllib.quote(url.encode(sys.getfilesystemencoding()), safe=':/#')
 
-    UNIT_PREFIXES = (('T', 2**40), ('G', 2**30), ('M', 2**20), ('K', 2**10),)
+    UNIT_PREFIXES = (('T', 2 ** 40), ('G', 2 ** 30), ('M', 2 ** 20), ('K', 2 ** 10),)
 
     def format_filesize(self, size_bytes):
         for unit_prefix, limit in self.UNIT_PREFIXES:
         self.add_dependency(self.dir.sort_task)
 
         self.set_template('browse.thtml')
-        self.load_tpl(self.media.type+'.thtml')
+        self.load_tpl(self.media.type + '.thtml')
 
     def build(self):
         page_rel_path = self.rel_path(self.dir.flattening_dir)
         print indent, self, self.get_mtime()
 
     def print_dep_tree(self, depth=1, parent_level=-1):
-        level = parent_level+1
+        level = parent_level + 1
         if level > depth: return
 
         self.print_dep_entry(level)

lazygal/mediautils.py

         for value_index in range(n_values):
             average = 0.0
             for histogram in self.histograms:
-                average = average + (float(histogram[value_index])/n_samples)
+                average = average + (float(histogram[value_index]) / n_samples)
             average_hist.append(average)
 
         # Find histogram closest to average histogram
             mse = 0.0
             for value_index in range(n_values):
                 gap = average_hist[value_index] - hist[value_index]
-                mse = mse + gap*gap
+                mse = mse + gap * gap
 
             if min_mse is None or mse < min_mse:
                 min_mse = mse

lazygal/newsize.py

     def dest_size(self, orig_size):
         match = self.matches()
         scale = int(match.group('scale'))
-        return tuple(map(lambda x: x*scale//100, orig_size))
+        return tuple(map(lambda x: x * scale // 100, orig_size))
 
 
 class XYScale(_Newsize):

lazygaltest/test_newsize.py

         orig_size = self.get_random_size()
         scale = self.get_random_percentage()
         size_string = '%d%%' % scale
-        real_dest_size = tuple(map(lambda x: x*scale//100, orig_size))
+        real_dest_size = tuple(map(lambda x: x * scale // 100, orig_size))
 
         self.check(orig_size, size_string, real_dest_size)
 
         size_string = '%d%%%d%%' % (xscale, yscale)
         x = orig_size[0]
         y = orig_size[1]
-        real_dest_size = (x*xscale//100, y*yscale//100)
+        real_dest_size = (x * xscale // 100, y * yscale // 100)
 
         self.check(orig_size, size_string, real_dest_size, ratiocheck=False)