Fix all minor typos and modifications in tests
[kamaki] / kamaki / clients / pithos / __init__.py
index 8aa7ca5..b0deade 100644 (file)
@@ -381,7 +381,7 @@ class PithosClient(PithosRestClient):
         :param public: (bool)
 
         :param container_info_cache: (dict) if given, avoid redundant calls to
-        server for container info (block size and hash information)
+            server for container info (block size and hash information)
         """
         self._assert_container()
 
@@ -510,7 +510,7 @@ class PithosClient(PithosRestClient):
         :param public: (bool)
 
         :param container_info_cache: (dict) if given, avoid redundant calls to
-        server for container info (block size and hash information)
+            server for container info (block size and hash information)
         """
         self._assert_container()
 
@@ -520,12 +520,9 @@ class PithosClient(PithosRestClient):
         if not content_type:
             content_type = 'application/octet-stream'
 
-        num_of_blocks, blockmod = size / blocksize, size % blocksize
-        num_of_blocks += (1 if blockmod else 0) if num_of_blocks else blockmod
-
         hashes = []
         hmap = {}
-        for blockid in range(num_of_blocks):
+        for blockid in range(nblocks):
             start = blockid * blocksize
             block = input_str[start: (start + blocksize)]
             hashes.append(_pithos_hash(block, blockhash))
@@ -547,8 +544,8 @@ class PithosClient(PithosRestClient):
         num_of_missing = len(missing)
 
         if upload_cb:
-            self.progress_bar_gen = upload_cb(num_of_blocks)
-            for i in range(num_of_blocks + 1 - num_of_missing):
+            self.progress_bar_gen = upload_cb(nblocks)
+            for i in range(nblocks + 1 - num_of_missing):
                 self._cb_next()
 
         tries = 7
@@ -955,18 +952,18 @@ class PithosClient(PithosRestClient):
             'X-Account-Policy-Quota',
             exactMatch=True)
 
-    def get_account_versioning(self):
-        """
-        :returns: (dict)
-        """
-        return filter_in(
-            self.get_account_info(),
-            'X-Account-Policy-Versioning',
-            exactMatch=True)
+    #def get_account_versioning(self):
+    #    """
+    #    :returns: (dict)
+    #    """
+    #    return filter_in(
+    #        self.get_account_info(),
+    #        'X-Account-Policy-Versioning',
+    #        exactMatch=True)
 
     def get_account_meta(self, until=None):
         """
-        :meta until: (str) formated date
+        :param until: (str) formated date
 
         :returns: (dict)
         """
@@ -993,20 +990,18 @@ class PithosClient(PithosRestClient):
         r = self.account_post(update=True, metadata={metakey: ''})
         return r.headers
 
-    """
-    def set_account_quota(self, quota):
-        ""
-        :param quota: (int)
-        ""
-        self.account_post(update=True, quota=quota)
-    """
+    #def set_account_quota(self, quota):
+    #    """
+    #    :param quota: (int)
+    #    """
+    #    self.account_post(update=True, quota=quota)
 
-    def set_account_versioning(self, versioning):
-        """
-        "param versioning: (str)
-        """
-        r = self.account_post(update=True, versioning=versioning)
-        return r.headers
+    #def set_account_versioning(self, versioning):
+    #    """
+    #    :param versioning: (str)
+    #    """
+    #    r = self.account_post(update=True, versioning=versioning)
+    #    return r.headers
 
     def list_containers(self):
         """
@@ -1116,6 +1111,8 @@ class PithosClient(PithosRestClient):
     def del_container_meta(self, metakey):
         """
         :param metakey: (str) metadatum key
+
+        :returns: (dict) response headers
         """
         r = self.container_post(update=True, metadata={metakey: ''})
         return r.headers
@@ -1270,7 +1267,6 @@ class PithosClient(PithosRestClient):
 
         :param upload_db: progress.bar for uploading
         """
-
         self._assert_container()
         meta = self.get_container_info()
         blocksize = int(meta['x-container-block-size'])
@@ -1315,6 +1311,9 @@ class PithosClient(PithosRestClient):
             sendlog.info('- - - wait for threads to finish')
             for thread in activethreads():
                 thread.join()
+        finally:
+            from time import sleep
+            sleep(2 * len(activethreads()))
         return headers.values()
 
     def truncate_object(self, obj, upto_bytes):