]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Simple mechanical cleanups 1699/head
authorChris Glass <tribaal@gmail.com>
Sat, 19 Apr 2014 12:03:19 +0000 (14:03 +0200)
committerChris Glass <tribaal@gmail.com>
Sat, 19 Apr 2014 12:58:33 +0000 (14:58 +0200)
* Removed trailing and useless whitespaces
* Removed useless imports.

Signed-off-by: Christopher Glass <christopher.glass@canonical.com>
src/pybind/ceph_argparse.py
src/pybind/ceph_rest_api.py
src/pybind/cephfs.py
src/pybind/rados.py
src/pybind/rbd.py

index 8f2eb8f25def317145876db4b28dbddf57246262..9873061c8589afbaccf0bd551f50811a9340e3e0 100644 (file)
@@ -829,7 +829,7 @@ def validate(args, signature, partial=False):
                 break
 
             # out of arguments for a required param?
-            # Either return (if partial validation) or raise 
+            # Either return (if partial validation) or raise
             if not myarg and desc.req:
                 if desc.N and desc.numseen < 1:
                     # wanted N, didn't even get 1
@@ -1013,7 +1013,7 @@ def find_cmd_target(childargs):
 
     return 'mon', ''
 
-def send_command(cluster, target=('mon', ''), cmd=None, inbuf='', timeout=0, 
+def send_command(cluster, target=('mon', ''), cmd=None, inbuf='', timeout=0,
                  verbose=False):
     """
     Send a command to a daemon using librados's
index 46d971edb2f233e5555b93b79c170f4565122abe..59d1ba28ddefaedfcb97cfdf8ef4869c1e25f77a 100755 (executable)
@@ -361,7 +361,7 @@ def handler(catchall_path=None, fmt=None, target=None):
     Main endpoint handler; generic for every endpoint, including catchall.
     Handles the catchall, anything with <.fmt>, anything with embedded
     <target>.  Partial match or ?help cause the HTML-table
-    "show_human_help" output.  
+    "show_human_help" output.
     '''
 
     ep = catchall_path or flask.request.endpoint
index 13a826254fce91958fd0de8ae2b9c01f066ec6d3..60849aeb75e8715e7da2056b507af4342ec8399e 100644 (file)
@@ -167,7 +167,7 @@ class LibCephFS(object):
 
     def shutdown(self):
         """
-        Unmount and destroy the ceph mount handle. 
+        Unmount and destroy the ceph mount handle.
         """
         if self.state != "shutdown":
             self.libcephfs.ceph_shutdown(self.cluster)
index e5da0771771ae5eb47b698ccbb85e14d667286aa..924b1bff50f1d8770fc0d7629a0d78578545257b 100644 (file)
@@ -144,7 +144,6 @@ class RadosThread(threading.Thread):
 POLL_TIME_INCR = 0.5
 
 def run_in_thread(target, args, timeout=0):
-    import sys
     interrupt = False
 
     countdown = timeout
@@ -182,7 +181,7 @@ def run_in_thread(target, args, timeout=0):
 class Rados(object):
     """librados python wrapper"""
     def require_state(self, *args):
-        """ 
+        """
         Checks if the Rados object is in a special state
 
         :raises: RadosStateError
@@ -266,7 +265,7 @@ Rados object in state %s." % (self.state))
     def version(self):
         """
         Get the version number of the ``librados`` C library.
-    
+
         :returns: a tuple of ``(major, minor, extra)`` components of the
                   librados version
         """
@@ -422,14 +421,14 @@ Rados object in state %s." % (self.state))
     def get_cluster_stats(self):
         """
         Read usage info about the cluster
-        
+
         This tells you total space, space used, space available, and number
         of objects. These are not updated immediately when data is written,
         they are eventually consistent.
 
         :returns: dict - contains the following keys:
 
-            - ``kb`` (int) - total space 
+            - ``kb`` (int) - total space
 
             - ``kb_used`` (int) - space used
 
@@ -521,7 +520,7 @@ Rados object in state %s." % (self.state))
         The pool is removed from the cluster immediately,
         but the actual data is deleted in the background.
 
-        :param pool_name: name of the pool to delete 
+        :param pool_name: name of the pool to delete
         :type pool_name: str
 
         :raises: :class:`TypeError`, :class:`Error`
@@ -536,7 +535,7 @@ Rados object in state %s." % (self.state))
 
     def list_pools(self):
         """
-        Gets a list of pool names. 
+        Gets a list of pool names.
 
         :returns: list - of pool names.
         """
@@ -573,13 +572,13 @@ Rados object in state %s." % (self.state))
         Create an io context
 
         The io context allows you to perform operations within a particular
-        pool. 
+        pool.
 
-        :param ioctx_name: name of the pool 
+        :param ioctx_name: name of the pool
         :type ioctx_name: str
 
         :raises: :class:`TypeError`, :class:`Error`
-        :returns: Ioctx - Rados Ioctx object 
+        :returns: Ioctx - Rados Ioctx object
         """
         self.require_state("connected")
         if not isinstance(ioctx_name, str):
@@ -596,7 +595,6 @@ Rados object in state %s." % (self.state))
         mon_command[_target](cmd, inbuf, outbuf, outbuflen, outs, outslen)
         returns (int ret, string outbuf, string outs)
         """
-        import sys
         self.require_state("connected")
         outbufp = pointer(pointer(c_char()))
         outbuflen = c_long()
@@ -634,7 +632,6 @@ Rados object in state %s." % (self.state))
         osd_command(osdid, cmd, inbuf, outbuf, outbuflen, outs, outslen)
         returns (int ret, string outbuf, string outs)
         """
-        import sys
         self.require_state("connected")
         outbufp = pointer(pointer(c_char()))
         outbuflen = c_long()
@@ -664,7 +661,6 @@ Rados object in state %s." % (self.state))
         pg_command(pgid, cmd, inbuf, outbuf, outbuflen, outs, outslen)
         returns (int ret, string outbuf, string outs)
         """
-        import sys
         self.require_state("connected")
         outbufp = pointer(pointer(c_char()))
         outbuflen = c_long()
@@ -782,7 +778,7 @@ ioctx '%s'" % self.ioctx.name)
         """
         Get the next Snapshot
 
-        :raises: :class:`Error`, StopIteration 
+        :raises: :class:`Error`, StopIteration
         :returns: Snap - next snapshot
         """
         if (self.cur_snap >= self.max_snap):
@@ -872,8 +868,8 @@ class Completion(object):
                              (self.rados_comp,))
 
     def __del__(self):
-        """ 
-        Release a completion 
+        """
+        Release a completion
 
         Call this when you no longer need the completion. It may not be
         freed immediately if the operation is not acked and committed.
@@ -907,8 +903,8 @@ class Ioctx(object):
         self.close()
 
     def __aio_safe_cb(self, completion, _):
-        """ 
-        Callback to onsafe() for asynchronous operations 
+        """
+        Callback to onsafe() for asynchronous operations
         """
         cb = None
         with self.lock:
@@ -918,8 +914,8 @@ class Ioctx(object):
         return 0
 
     def __aio_complete_cb(self, completion, _):
-        """ 
-        Callback to oncomplete() for asynchronous operations 
+        """
+        Callback to oncomplete() for asynchronous operations
         """
         cb = None
         with self.lock:
@@ -940,7 +936,7 @@ class Ioctx(object):
         :type onsafe: completion
 
         :raises: :class:`Error`
-        :returns: completion object 
+        :returns: completion object
         """
         completion = c_void_p(0)
         complete_cb = None
@@ -983,7 +979,7 @@ class Ioctx(object):
         :type onsafe: completion
 
         :raises: :class:`Error`
-        :returns: completion object 
+        :returns: completion object
         """
         completion = self.__get_completion(oncomplete, onsafe)
         ret = run_in_thread(self.librados.rados_aio_write,
@@ -1015,7 +1011,7 @@ class Ioctx(object):
         :type onsafe: completion
 
         :raises: :class:`Error`
-        :returns: completion object 
+        :returns: completion object
         """
         completion = self.__get_completion(oncomplete, onsafe)
         ret = run_in_thread(self.librados.rados_aio_write_full,
@@ -1046,7 +1042,7 @@ class Ioctx(object):
         :type onsafe: completion
 
         :raises: :class:`Error`
-        :returns: completion object 
+        :returns: completion object
         """
         completion = self.__get_completion(oncomplete, onsafe)
         ret = run_in_thread(self.librados.rados_aio_append,
@@ -1206,7 +1202,7 @@ class Ioctx(object):
 
         :raises: :class:`TypeError`
         :raises: :class:`LogicError`
-        :returns: int - number of bytes written 
+        :returns: int - number of bytes written
         """
         self.require_ioctx_open()
         if not isinstance(key, str):
@@ -1298,7 +1294,7 @@ returned %d, but should return zero on success." % (self.name, ret))
         :param key: name of the object
         :type key: str
         :param length: the number of bytes to read (default=8192)
-        :type length: int 
+        :type length: int
         :param offset: byte offset in the object to begin reading at
         :type offset: int
 
@@ -1405,7 +1401,7 @@ returned %d, but should return zero on success." % (self.name, ret))
         :raises: :class:`Error`
         :returns: int - 0 on success, otherwise raises error
         """
-        
+
         self.require_ioctx_open()
         if not isinstance(key, str):
             raise TypeError('key must be a string')
@@ -1418,7 +1414,7 @@ returned %d, but should return zero on success." % (self.name, ret))
     def stat(self, key):
         """
         Get object stats (size/mtime)
-        
+
         :param key: the name of the object to get stats from
         :type key: str
 
@@ -1442,7 +1438,7 @@ returned %d, but should return zero on success." % (self.name, ret))
     def get_xattr(self, key, xattr_name):
         """
         Get the value of an extended attribute on an object.
-        
+
         :param key: the name of the object to get xattr from
         :type key: str
         :param xattr_name: which extended attribute to read
@@ -1472,7 +1468,7 @@ returned %d, but should return zero on success." % (self.name, ret))
     def get_xattrs(self, oid):
         """
         Start iterating over xattrs on an object.
-        
+
         :param oid: the name of the object to get xattrs from
         :type key: str
 
@@ -1493,7 +1489,7 @@ returned %d, but should return zero on success." % (self.name, ret))
     def set_xattr(self, key, xattr_name, xattr_value):
         """
         Set an extended attribute on an object.
-        
+
         :param key: the name of the object to set xattr to
         :type key: str
         :param xattr_name: which extended attribute to set
@@ -1522,7 +1518,7 @@ returned %d, but should return zero on success." % (self.name, ret))
     def rm_xattr(self, key, xattr_name):
         """
         Removes an extended attribute on from an object.
-        
+
         :param key: the name of the object to remove xattr from
         :type key: str
         :param xattr_name: which extended attribute to remove
@@ -1545,7 +1541,7 @@ returned %d, but should return zero on success." % (self.name, ret))
         return True
 
     def list_objects(self):
-        """ 
+        """
         Get ObjectIterator on rados.Ioctx object.
 
         :returns: ObjectIterator
@@ -1554,7 +1550,7 @@ returned %d, but should return zero on success." % (self.name, ret))
         return ObjectIterator(self)
 
     def list_snaps(self):
-        """ 
+        """
         Get SnapIterator on rados.Ioctx object.
 
         :returns: SnapIterator
@@ -1712,7 +1708,7 @@ MONITOR_LEVELS = [
    "debug",
    "info",
    "warn", "warning",
-   "err", "error", 
+   "err", "error",
    "sec",
    ]
 
index bf075769d8be07d54ae2f1ae624e0b9bb0ad1928..ef41454ecbbc68ba5bc1bc1f0f4f4095290a6908 100644 (file)
@@ -456,7 +456,7 @@ class Image(object):
             pool = create_string_buffer(size)
             name = create_string_buffer(size)
             snapname = create_string_buffer(size)
-            ret = self.librbd.rbd_get_parent_info(self.image, pool, len(pool), 
+            ret = self.librbd.rbd_get_parent_info(self.image, pool, len(pool),
                 name, len(name), snapname, len(snapname))
             if ret == -errno.ERANGE:
                 size *= 2