<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body smarttemplateinserted="true" text="#000000" bgcolor="#FFFFFF">
    <div id="smartTemplate4-quoteHeader"><br>
      <div id="smartTemplate4-template">Reviewed-by:&nbsp;ShaoHe&nbsp;Feng&nbsp;<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
        <br>
      </div>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
    <div class="moz-cite-prefix">On 12/18/2013 06:20 PM, Zhou Zheng
      Sheng wrote:<br>
    </div>
    <blockquote
      cite="mid:1387362051-21574-1-git-send-email-zhshzhou@linux.vnet.ibm.com"
      type="cite">
      <pre wrap="">Make this file PEP 8 clean

Signed-off-by: Zhou Zheng Sheng <a class="moz-txt-link-rfc2396E" href="mailto:zhshzhou@linux.vnet.ibm.com">&lt;zhshzhou@linux.vnet.ibm.com&gt;</a>
---
 Makefile.am         |  1 +
 src/kimchi/disks.py | 37 ++++++++++++++++++++-----------------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b79919c..e57d3b6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,6 +40,7 @@ EXTRA_DIST = \
 PEP8_WHITELIST = \
         src/kimchi/asynctask.py \
         src/kimchi/config.py.in \
+        src/kimchi/disks.py \
         src/kimchi/server.py \
         plugins/__init__.py \
         plugins/sample/__init__.py \
diff --git a/src/kimchi/disks.py b/src/kimchi/disks.py
index 93d5dbc..874f669 100644
--- a/src/kimchi/disks.py
+++ b/src/kimchi/disks.py
@@ -18,26 +18,26 @@
 #
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

-import collections
-import os
 import re
 import subprocess
-import sys

 from kimchi.exception import OperationFailed

+
 def get_partitions_paths():
     try:
         """ Returns all available partitions path of the host """
-        blkid = subprocess.Popen(["blkid", "-o", "device" ],
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        blkid = subprocess.Popen(
+            ["blkid", "-o", "device"],
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         dev_paths = blkid.communicate()[0].rstrip("\n").split("\n")
     except:
         raise OperationFailed("Unable to retrieve partitions' full path.")
     return dev_paths

+
 def get_partition_path(name, dev_paths):
     """ Returns device path given a partition name """
     dev_path = None
@@ -49,11 +49,13 @@ def get_partition_path(name, dev_paths):
     if dev_path:
         return dev_path

+
 def get_partitions_names():
     try:
         """ Returns all the names of available partitions  """
-        lsblk = subprocess.Popen(["lsblk", "-Pbo","NAME,TYPE" ],
-                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        lsblk = subprocess.Popen(
+            ["lsblk", "-Pbo", "NAME,TYPE"],
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         output = lsblk.communicate()[0]
         lines_output = output.rstrip("\n").split("\n")
         # Will be used later to double check the partition
@@ -67,11 +69,12 @@ def get_partitions_names():
                 expression = r"%s=\".*?\"" % key
                 match = re.search(expression, line)
                 field = match.group()
-                k, v = field.split('=',1)
+                k, v = field.split('=', 1)
                 d[k.lower()] = v[1:-1]
-            if d['type'] not in ['part','lvm']:
+            if d['type'] not in ['part', 'lvm']:
                 continue
-            # split()[0] to avoid the second part of the name, after the whiteline
+            # split()[0] to avoid the second part of the name,
+            # after the whiteline
             name = d['name'].split()[0]
             # There are special cases where lsblk reports
             # a partition that does not exist in blkid and fdisk (Extended
@@ -84,18 +87,18 @@ def get_partitions_names():
     except:
         raise OperationFailed("Unable to retrieve partitions' full path.")

+
 def get_partition_details(name):
     try:
         # Find device path
-        dev_path = get_partition_path(name,
-                   get_partitions_paths())
+        dev_path = get_partition_path(name, get_partitions_paths())
         # Couldn't find dev_path.
         if not dev_path:
             return
         # Executing lsblk to get partition/disk info
-        lsblk = subprocess.Popen(["lsblk", "-Pbo",
-                "TYPE,FSTYPE,SIZE,MOUNTPOINT", dev_path ],
-                stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+        lsblk = subprocess.Popen(
+            ["lsblk", "-Pbo", "TYPE,FSTYPE,SIZE,MOUNTPOINT", dev_path],
+            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         # single line output
         output = lsblk.communicate()[0].rstrip("\n")
         # output is on format key="value", where key = NAME, TYPE, FSTYPE,
@@ -106,7 +109,7 @@ def get_partition_details(name):
             expression = r"%s=\".*?\"" % key
             match = re.search(expression, output)
             field = match.group()
-            k, v = field.split('=',1)
+            k, v = field.split('=', 1)
             d[k.lower()] = v[1:-1]
         if d['mountpoint']:
             # Sometimes the mountpoint comes with [SWAP] or other
</pre>
    </blockquote>
    <br>
    <div class="moz-signature">
      <pre>Sheldon Feng(&#20911;&#23569;&#21512;)<shaohef@linux.vnet.ibm.com>
IBM Linux Technology Center</shaohef@linux.vnet.ibm.com></pre>
    </div>
  </body>
</html>

<p></p>

-- <br />
project-kimchi mailing list &lt;project-kimchi@googlegroups.com&gt;<br />
<a href="https://groups.google.com/forum/#!forum/project-kimchi">https://groups.google.com/forum/#!forum/project-kimchi</a><br />
--- <br />
You received this message because you are subscribed to the Google Groups &quot;project-kimchi&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to project-kimchi+unsubscribe@googlegroups.com.<br />
For more options, visit <a href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out</a>.<br />