[Kimchi-devel] [PATCHv7 7/7] Multiple pep8 fixes

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Mon Mar 10 09:05:46 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

These can be diagnosed by pep8 1.3.3,
but may not report error in some version,
These errors does not comply:
    http://www.python.org/dev/peps/pep-0008/
so fix them.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py            | 7 ++++---
 src/kimchi/model/debugreports.py   | 2 +-
 src/kimchi/model/storagevolumes.py | 3 ++-
 src/kimchi/model/templates.py      | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 1460d67..1d78ca0 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -220,7 +220,7 @@ class MockModel(object):
         if not name:
             iso = params['cdrom']
             iso_name = os.path.splitext(iso[iso.rfind('/') + 1:])[0]
-            name = iso_name + str(int(time.time()*1000))
+            name = iso_name + str(int(time.time() * 1000))
             params['name'] = name
 
         if name in self._mock_templates:
@@ -918,7 +918,8 @@ class MockVMIface(object):
 
     @classmethod
     def get_mac(cls):
-        mac = ":".join(["52", "54"] + ["%02x" % (cls.counter/(256**i) % 256)
+        mac = ":".join(["52", "54"] +
+                       ["%02x" % (cls.counter / (256 ** i) % 256)
                        for i in range(3, -1, -1)])
         return mac
 
@@ -1046,7 +1047,7 @@ class MockVMScreenshot(VMScreenshot):
         self.coord = (self.coord[0],
                       self.coord[1],
                       min(MockVMScreenshot.BOX_COORD[2],
-                          self.coord[2]+random.randrange(50)),
+                          self.coord[2] + random.randrange(50)),
                       self.coord[3])
 
         image = Image.new("RGB", (256, 256), self.background)
diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
index 3e14848..c6e698b 100644
--- a/src/kimchi/model/debugreports.py
+++ b/src/kimchi/model/debugreports.py
@@ -41,7 +41,7 @@ class DebugReportsModel(object):
         ident = params.get('name').strip()
         # Generate a name with time and millisec precision, if necessary
         if ident is None or ident == "":
-            ident = 'report-' + str(int(time.time()*1000))
+            ident = 'report-' + str(int(time.time() * 1000))
         taskid = self._gen_debugreport_file(ident)
         return self.task.lookup(taskid)
 
diff --git a/src/kimchi/model/storagevolumes.py b/src/kimchi/model/storagevolumes.py
index 3b4da82..1253823 100644
--- a/src/kimchi/model/storagevolumes.py
+++ b/src/kimchi/model/storagevolumes.py
@@ -129,7 +129,8 @@ class StorageVolumeModel(object):
                 for vm in vms:
                     storages = VMStoragesModel(**args).get_list(vm)
                     for disk in storages:
-                        if path == VMStorageModel(**args).lookup(vm, disk)['path']:
+                        d_info = VMStorageModel(**args).lookup(vm, disk)
+                        if path == d_info['path']:
                             ref_cnt = ref_cnt + 1
                 session.store('storagevolume', vol_id, {'ref_cnt': ref_cnt})
 
diff --git a/src/kimchi/model/templates.py b/src/kimchi/model/templates.py
index 52e7eab..2e66a94 100644
--- a/src/kimchi/model/templates.py
+++ b/src/kimchi/model/templates.py
@@ -39,7 +39,7 @@ class TemplatesModel(object):
         if not name:
             iso = params['cdrom']
             iso_name = os.path.splitext(iso[iso.rfind('/') + 1:])[0]
-            name = iso_name + str(int(time.time()*1000))
+            name = iso_name + str(int(time.time() * 1000))
             params['name'] = name
 
         conn = self.conn.get()
-- 
1.8.1.2




More information about the Kimchi-devel mailing list