commit b56367048a946a190a1df5b4d7d99e3fe3b2e0b7
Author: Chrysostomos Nanakos <cnanakos@grnet.gr>
Date:   Tue Nov 12 17:44:33 2013 +0200

    pithos: pep8 fixes

diff --git a/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagoblocker.py b/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagoblocker.py
index deccd56..6b5247d 100644
--- a/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagoblocker.py
+++ b/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagoblocker.py
@@ -33,7 +33,8 @@
 
 from hashlib import new as newhasher
 from binascii import hexlify
-import os, re
+import os
+import re
 
 from context_archipelago import ArchipelagoObject, file_sync_read_chunks
 from archipelago.common import (
@@ -42,12 +43,16 @@ from archipelago.common import (
     string_at,
     )
 
-from pithos.workers import glue, monkey
+from pithos.workers import (
+    glue,
+    monkey,
+    )
 
 monkey.patch_Request()
 
 from pithos.api.settings import BACKEND_ARCHIPELAGO_CONF
 
+
 class ArchipelagoBlocker(object):
     """Blocker.
        Required constructor parameters: blocksize, hashtype.
@@ -61,7 +66,7 @@ class ArchipelagoBlocker(object):
         cfg = {}
         bcfg = open(BACKEND_ARCHIPELAGO_CONF).read()
         cfg['blockerb'] = re.search('\'blockerb_port\'\s*:\s*\d+',
-                bcfg).group(0).split(':')[1]
+                                    bcfg).group(0).split(':')[1]
         blocksize = params['blocksize']
         hashtype = params['hashtype']
         try:
@@ -85,12 +90,12 @@ class ArchipelagoBlocker(object):
 
     def _get_rear_block(self, blkhash, create=0):
         name = hexlify(blkhash)
-        return ArchipelagoObject(name, self.ioctx_pool,self.dst_port,create)
+        return ArchipelagoObject(name, self.ioctx_pool, self.dst_port, create)
 
     def _check_rear_block(self, blkhash):
         filename = hexlify(blkhash)
         ioctx = self.ioctx_pool.pool_get()
-        req = Request.get_info_request(ioctx,self.dst_port,filename)
+        req = Request.get_info_request(ioctx, self.dst_port, filename)
         req.submit()
         req.wait()
         ret = req.success()
@@ -182,7 +187,6 @@ class ArchipelagoBlocker(object):
         self.ioctx_pool.pool_put(ioctx)
         return blocks
 
-
     def block_stor(self, blocklist):
         """Store a bunch of blocks and return (hashes, missing).
            Hashes is a list of the hashes of the blocks,
@@ -232,7 +236,8 @@ class ArchipelagoBlocker(object):
         append = hashes.append
         block_hash = self.block_hash
 
-        for block in file_sync_read_chunks(archipelagoobject, self.blocksize, 1, 0):
+        for block in file_sync_read_chunks(archipelagoobject,
+                                           self.blocksize, 1, 0):
             append(block_hash(block))
 
         return hashes
diff --git a/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagomapper.py b/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagomapper.py
index 55cb836..6b55438 100644
--- a/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagomapper.py
+++ b/snf-pithos-backend/pithos/backends/lib/hashfiler/archipelagomapper.py
@@ -32,7 +32,8 @@
 # or implied, of GRNET S.A.
 
 from binascii import hexlify
-import os, re
+import os
+import re
 import ctypes
 
 from context_archipelago import ArchipelagoObject
@@ -68,9 +69,9 @@ class ArchipelagoMapper(object):
         cfg = {}
         bcfg = open(BACKEND_ARCHIPELAGO_CONF).read()
         cfg['blockerm'] = re.search('\'blockerm_port\'\s*:\s*\d+',
-                                        bcfg).group(0).split(':')[1]
+                                    bcfg).group(0).split(':')[1]
         cfg['mapperd'] = re.search('\'mapper_port\'\s*:\s*\d+',
-                                        bcfg).group(0).split(':')[1]
+                                   bcfg).group(0).split(':')[1]
         self.ioctx_pool = ioctx_pool
         self.dst_port = int(cfg['blockerm'])
         self.mapperd_port = int(cfg['mapperd'])
@@ -113,23 +114,25 @@ class ArchipelagoMapper(object):
         else:
             req.put()
             self.ioctx_pool.pool_put(ioctx)
-            raise RuntimeError("Hashmap '%s' doesn't exists" % hexlify(maphash))
+            raise RuntimeError("Hashmap '%s' doesn't exists" %
+                               hexlify(maphash))
         req = Request.get_read_request(ioctx, self.dst_port,
-                                       hexlify(maphash), size = size)
+                                       hexlify(maphash), size=size)
         req.submit()
         req.wait()
         ret = req.success()
         if ret:
-            data = string_at(req.get_data(),size)
+            data = string_at(req.get_data(), size)
             req.put()
             self.ioctx_pool.pool_put(ioctx)
-            for idx in xrange(0,len(data),namelen):
+            for idx in xrange(0, len(data), namelen):
                 hashes = hashes + (data[idx:idx+namelen],)
             hashes = list(hashes)
         else:
             req.put()
             self.ioctx_pool.pool_put(ioctx)
-            raise RuntimeError("Hashmap '%s' doesn't exists" % hexlify(maphash))
+            raise RuntimeError("Hashmap '%s' doesn't exists" %
+                               hexlify(maphash))
         return hashes
 
     def map_retr_archipelago(self, maphash, size):
@@ -151,7 +154,8 @@ class ArchipelagoMapper(object):
             self.ioctx_pool.pool_put(ioctx)
             raise Exception("Could not retrieve Archipelago mapfile.")
         self.ioctx_pool.pool_put(ioctx)
-        return [string_at(segs[idx].target, segs[idx].targetlen) for idx in xrange(len(segs))]
+        return [string_at(segs[idx].target, segs[idx].targetlen)
+                for idx in xrange(len(segs))]
 
     def map_stor(self, maphash, hashes=(), blkoff=0, create=1):
         """Store hashes in the given hashes map."""
diff --git a/snf-pithos-backend/pithos/backends/lib/hashfiler/blocker.py b/snf-pithos-backend/pithos/backends/lib/hashfiler/blocker.py
index b259f51..a6e5d3f 100644
--- a/snf-pithos-backend/pithos/backends/lib/hashfiler/blocker.py
+++ b/snf-pithos-backend/pithos/backends/lib/hashfiler/blocker.py
@@ -81,7 +81,7 @@ class Blocker(object):
         archip_hash = None
         archip_existed = True
         (archip_hash, archip_existed) = \
-                self.archip_blocker.block_delta(blkhash, offset, data)
+            self.archip_blocker.block_delta(blkhash, offset, data)
 
         if not archip_hash:
             return None, None
diff --git a/snf-pithos-backend/pithos/backends/lib/hashfiler/context_archipelago.py b/snf-pithos-backend/pithos/backends/lib/hashfiler/context_archipelago.py
index 9ac7477..be87e97 100644
--- a/snf-pithos-backend/pithos/backends/lib/hashfiler/context_archipelago.py
+++ b/snf-pithos-backend/pithos/backends/lib/hashfiler/context_archipelago.py
@@ -33,9 +33,9 @@
 
 from os import SEEK_CUR, SEEK_SET
 from archipelago.common import (
-                        Request,
-                        string_at,
-                    )
+    Request,
+    string_at,
+    )
 from pithos.workers import monkey
 monkey.patch_Request()
 
@@ -139,7 +139,7 @@ class ArchipelagoObject(object):
                                    in archipelago")
 
     def sync_write(self, data):
-        ioctx = self.ioctx_pool.pool_get() 
+        ioctx = self.ioctx_pool.pool_get()
         req = Request.get_write_request(ioctx, self.dst_port, self.name,
                                         data=data, offset=self.offset,
                                         datalen=len(data))
@@ -154,7 +154,7 @@ class ArchipelagoObject(object):
             raise IOError("archipelago: Write request error")
 
     def sync_write_chunks(self, chunksize, offset, chunks, size=None):
-        return file_sync_write_chunks(self, chunksize, offset, chunks,size)
+        return file_sync_write_chunks(self, chunksize, offset, chunks, size)
 
     def sync_read(self, size):
         read = Request.get_read_request
@@ -162,14 +162,14 @@ class ArchipelagoObject(object):
         datalen = 0
         dsize = size
         while 1:
-            ioctx = self.ioctx_pool.pool_get() 
+            ioctx = self.ioctx_pool.pool_get()
             req = read(ioctx, self.dst_port,
-                       self.name,size=dsize-datalen,offset=self.offset)
+                       self.name, size=dsize-datalen, offset=self.offset)
             req.submit()
             req.wait()
             ret = req.success()
             if ret:
-                s = string_at(req.get_data(),dsize-datalen)
+                s = string_at(req.get_data(), dsize-datalen)
             else:
                 s = None
             req.put()
diff --git a/snf-pithos-backend/pithos/backends/lib/hashfiler/store.py b/snf-pithos-backend/pithos/backends/lib/hashfiler/store.py
index bb7de11..e009287 100644
--- a/snf-pithos-backend/pithos/backends/lib/hashfiler/store.py
+++ b/snf-pithos-backend/pithos/backends/lib/hashfiler/store.py
@@ -49,11 +49,11 @@ class Store(object):
             os.umask(umask)
 
         pb = {'blocksize': params['block_size'],
-             'hashtype': params['hash_algorithm'],
-            }
+              'hashtype': params['hash_algorithm'],
+              }
         self.blocker = Blocker(**pb)
         pm = {'namelen': self.blocker.hashlen,
-            }
+              }
         self.mapper = Mapper(**pm)
 
     def map_get(self, name):
diff --git a/snf-pithos-backend/pithos/workers/glue.py b/snf-pithos-backend/pithos/workers/glue.py
index d017f12..e9614e3 100644
--- a/snf-pithos-backend/pithos/workers/glue.py
+++ b/snf-pithos-backend/pithos/workers/glue.py
@@ -35,6 +35,7 @@
 
 import re
 
+
 class WorkerGlue(object):
 
     pmap = {}
@@ -55,9 +56,9 @@ class WorkerGlue(object):
         cfg = {}
         bcfg = open(ARCHIPELAGO_CONF_FILE).read()
         cfg['SEGMENT_PORTS'] = re.search('SEGMENT_PORTS\s*=\s*\d+',
-                bcfg).group(0).split('=')[1]
+                                         bcfg).group(0).split('=')[1]
         cfg['SEGMENT_SIZE'] = re.search('SEGMENT_SIZE\s*=\s*\d+',
-                bcfg).group(0).split('=')[1]
+                                        bcfg).group(0).split('=')[1]
         ARCHIPELAGO_SEGMENT_PORTS = int(cfg['SEGMENT_PORTS'])
         ARCHIPELAGO_SEGMENT_SIZE = int(cfg['SEGMENT_SIZE'])
         ARCHIPELAGO_SEGMENT_ALIGNMENT = 12
