[Kimchi-devel] [RFC PATCH V2 31/31] Organize imports in all .py files

Lucio Correia luciojhc at linux.vnet.ibm.com
Mon Jun 22 22:59:45 UTC 2015


Separate imports into following sections:
1) Import common modules
import ...
import ...
from ... import ...
from ... import ...

2) Import wok modules
import wok.<mod>
import wok.<mod>
from wok import ...
from wok import ...

3) Import plugin modules
import ..<mod>
import <mod>
from ..<mod> import ...
from <mod> import ...

Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
Signed-off-by: Gustavo Y. Ribeiro <gyr at linux.vnet.ibm.com>
---
 plugins/kimchi/control/host.py                   |    3 +-
 plugins/kimchi/control/storagepools.py           |    5 ++-
 plugins/kimchi/control/vms.py                    |    1 +
 plugins/kimchi/disks.py                          |    1 -
 plugins/kimchi/distroloader.py                   |    3 +-
 plugins/kimchi/imageinfo.py                      |    2 +-
 plugins/kimchi/isoinfo.py                        |    2 +-
 plugins/kimchi/kvmusertests.py                   |    2 +-
 plugins/kimchi/mockmodel.py                      |   13 ++++-----
 plugins/kimchi/model/config.py                   |   14 +++++-----
 plugins/kimchi/model/cpuinfo.py                  |    4 +-
 plugins/kimchi/model/debugreports.py             |    9 ++++---
 plugins/kimchi/model/diskutils.py                |    4 +-
 plugins/kimchi/model/featuretests.py             |    4 +-
 plugins/kimchi/model/host.py                     |   18 +++++++-------
 plugins/kimchi/model/hostdev.py                  |    3 +-
 plugins/kimchi/model/interfaces.py               |    1 +
 plugins/kimchi/model/libvirtconnection.py        |    5 +--
 plugins/kimchi/model/libvirtstoragepool.py       |   10 ++++----
 plugins/kimchi/model/model.py                    |    3 +-
 plugins/kimchi/model/networks.py                 |   13 ++++-----
 plugins/kimchi/model/peers.py                    |    2 +-
 plugins/kimchi/model/storagepools.py             |   12 ++++----
 plugins/kimchi/model/storageservers.py           |    1 +
 plugins/kimchi/model/storagetargets.py           |    3 +-
 plugins/kimchi/model/storagevolumes.py           |   12 ++++----
 plugins/kimchi/model/templates.py                |   10 ++++----
 plugins/kimchi/model/utils.py                    |    1 +
 plugins/kimchi/model/vmhostdevs.py               |   10 ++++----
 plugins/kimchi/model/vmifaces.py                 |    6 ++--
 plugins/kimchi/model/vms.py                      |   28 +++++++++++-----------
 plugins/kimchi/model/vmsnapshots.py              |    8 +++---
 plugins/kimchi/model/vmstorages.py               |   15 ++++++-----
 plugins/kimchi/osinfo.py                         |    1 -
 plugins/kimchi/repositories.py                   |    4 +-
 plugins/kimchi/root.py                           |    6 ++--
 plugins/kimchi/scan.py                           |    2 +-
 plugins/kimchi/screenshot.py                     |    4 +-
 plugins/kimchi/swupdate.py                       |    5 ++-
 plugins/kimchi/tests/iso_gen.py                  |    1 +
 plugins/kimchi/tests/test_authorization.py       |    2 +-
 plugins/kimchi/tests/test_config.py.in           |    4 ++-
 plugins/kimchi/tests/test_exception.py           |    3 +-
 plugins/kimchi/tests/test_host.py                |    3 +-
 plugins/kimchi/tests/test_mock_network.py        |    2 +-
 plugins/kimchi/tests/test_mock_storagepool.py    |    2 +-
 plugins/kimchi/tests/test_mock_storagevolume.py  |    2 +-
 plugins/kimchi/tests/test_mockmodel.py           |    4 +-
 plugins/kimchi/tests/test_model.py               |   11 ++++----
 plugins/kimchi/tests/test_model_network.py       |    5 ++-
 plugins/kimchi/tests/test_model_storagepool.py   |    5 ++-
 plugins/kimchi/tests/test_model_storagevolume.py |    7 +++--
 plugins/kimchi/tests/test_networkxml.py          |    7 +++--
 plugins/kimchi/tests/test_objectstore.py         |    3 +-
 plugins/kimchi/tests/test_osinfo.py              |    1 -
 plugins/kimchi/tests/test_plugin.py              |    7 ++---
 plugins/kimchi/tests/test_rest.py                |    9 ++++---
 plugins/kimchi/tests/test_server.py              |    8 ++++--
 plugins/kimchi/tests/test_template.py            |    2 +-
 plugins/kimchi/tests/test_vmtemplate.py          |    2 +-
 plugins/kimchi/tests/test_yumparser.py           |    7 +++--
 plugins/kimchi/tests/utils.py                    |    8 +++---
 plugins/kimchi/vmtemplate.py                     |    8 +++---
 plugins/kimchi/xmlutils/disk.py                  |    2 +-
 plugins/kimchi/xmlutils/graphics.py              |    1 -
 plugins/kimchi/xmlutils/interface.py             |    1 -
 plugins/kimchi/xmlutils/network.py               |    1 -
 plugins/kimchi/yumparser.py                      |    2 +-
 plugins/sample/__init__.py                       |    4 +-
 plugins/sample/model.py                          |    2 +-
 src/wok/config.py.in                             |    2 -
 src/wok/control/base.py                          |    4 +-
 src/wok/control/utils.py                         |    2 -
 src/wok/objectstore.py                           |    1 -
 src/wok/root.py                                  |    3 +-
 src/wok/server.py                                |    2 +-
 src/wok/sslcert.py                               |    2 -
 src/wok/template.py                              |    4 +-
 src/wok/utils.py                                 |    2 +-
 src/wok/vnc.py                                   |    1 -
 80 files changed, 204 insertions(+), 195 deletions(-)

diff --git a/plugins/kimchi/control/host.py b/plugins/kimchi/control/host.py
index 6634d8f..0a40f1b 100644
--- a/plugins/kimchi/control/host.py
+++ b/plugins/kimchi/control/host.py
@@ -17,11 +17,12 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-from cpuinfo import CPUInfo
 from wok.control.base import Collection, Resource, SimpleCollection
 from wok.control.utils import UrlSubNode
 from wok.exception import NotFoundError
 
+from cpuinfo import CPUInfo
+
 
 @UrlSubNode('host', True)
 class Host(Resource):
diff --git a/plugins/kimchi/control/storagepools.py b/plugins/kimchi/control/storagepools.py
index 4a83c20..e5f264e 100644
--- a/plugins/kimchi/control/storagepools.py
+++ b/plugins/kimchi/control/storagepools.py
@@ -20,12 +20,13 @@
 import cherrypy
 
 from wok.control.base import Collection, Resource
-from storagevolumes import IsoVolumes, StorageVolumes
 from wok.control.utils import get_class_name, model_fn
 from wok.control.utils import validate_params
-from ..model.storagepools import ISO_POOL_NAME
 from wok.control.utils import UrlSubNode
 
+from ..model.storagepools import ISO_POOL_NAME
+from storagevolumes import IsoVolumes, StorageVolumes
+
 
 @UrlSubNode('storagepools', True)
 class StoragePools(Collection):
diff --git a/plugins/kimchi/control/vms.py b/plugins/kimchi/control/vms.py
index c8105bc..858b23c 100644
--- a/plugins/kimchi/control/vms.py
+++ b/plugins/kimchi/control/vms.py
@@ -19,6 +19,7 @@
 
 from wok.control.base import AsyncCollection, Resource
 from wok.control.utils import internal_redirect, UrlSubNode
+
 from vm import sub_nodes
 
 
diff --git a/plugins/kimchi/disks.py b/plugins/kimchi/disks.py
index 88a69f4..eb40e3a 100644
--- a/plugins/kimchi/disks.py
+++ b/plugins/kimchi/disks.py
@@ -20,7 +20,6 @@
 import os.path
 import re
 import subprocess
-
 from parted import Device as PDevice
 from parted import Disk as PDisk
 
diff --git a/plugins/kimchi/distroloader.py b/plugins/kimchi/distroloader.py
index a593246..0032737 100644
--- a/plugins/kimchi/distroloader.py
+++ b/plugins/kimchi/distroloader.py
@@ -23,10 +23,11 @@ import json
 import os
 
 
-import config
 from wok.exception import NotFoundError, OperationFailed
 from wok.utils import wok_log
 
+import config
+
 
 ARCHS = {'x86_64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
          'amd64': ['x86_64', 'amd64', 'i686', 'x86', 'i386'],
diff --git a/plugins/kimchi/imageinfo.py b/plugins/kimchi/imageinfo.py
index 7d92f54..8a22495 100644
--- a/plugins/kimchi/imageinfo.py
+++ b/plugins/kimchi/imageinfo.py
@@ -17,10 +17,10 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
+import guestfs
 import json
 import os
 import sys
-import guestfs
 
 from wok.exception import ImageFormatError, InvalidParameter, TimeoutExpired
 from wok.utils import run_command, wok_log
diff --git a/plugins/kimchi/isoinfo.py b/plugins/kimchi/isoinfo.py
index cec20b1..8de6885 100644
--- a/plugins/kimchi/isoinfo.py
+++ b/plugins/kimchi/isoinfo.py
@@ -19,8 +19,8 @@
 
 import contextlib
 import glob
-import platform
 import os
+import platform
 import re
 import stat
 import struct
diff --git a/plugins/kimchi/kvmusertests.py b/plugins/kimchi/kvmusertests.py
index ace157e..35350d8 100644
--- a/plugins/kimchi/kvmusertests.py
+++ b/plugins/kimchi/kvmusertests.py
@@ -16,11 +16,11 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
+import libvirt
 import platform
 import psutil
 import threading
 
-import libvirt
 
 from wok.rollbackcontext import RollbackContext
 
diff --git a/plugins/kimchi/mockmodel.py b/plugins/kimchi/mockmodel.py
index d51ab9e..e316c21 100644
--- a/plugins/kimchi/mockmodel.py
+++ b/plugins/kimchi/mockmodel.py
@@ -22,16 +22,18 @@ import lxml.etree as ET
 import os
 import random
 import time
-
-from model import cpuinfo
-
 from lxml import objectify
 from lxml.builder import E
 
+from wok.exception import NotFoundError, OperationFailed
+from wok.objectstore import ObjectStore
+from wok.utils import add_task, get_next_clone_name, wok_log
+from wok.xmlutils.utils import xml_item_update
+
 import config
 import imageinfo
 import osinfo
-from wok.exception import NotFoundError, OperationFailed
+from model import cpuinfo
 from model.debugreports import DebugReportsModel
 from model.host import DeviceModel
 from model.libvirtstoragepool import IscsiPoolDef, NetfsPoolDef
@@ -42,10 +44,7 @@ from model.storagevolumes import StorageVolumeModel, StorageVolumesModel
 from model.templates import LibvirtVMTemplate
 from model.users import PAMUsersModel
 from model.groups import PAMGroupsModel
-from wok.objectstore import ObjectStore
-from wok.utils import add_task, get_next_clone_name, wok_log
 from vmtemplate import VMTemplate
-from wok.xmlutils.utils import xml_item_update
 
 
 fake_user = {'root': 'letmein!'}
diff --git a/plugins/kimchi/model/config.py b/plugins/kimchi/model/config.py
index d0799fe..371e382 100644
--- a/plugins/kimchi/model/config.py
+++ b/plugins/kimchi/model/config.py
@@ -17,23 +17,23 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-from multiprocessing.pool import ThreadPool
-
 import cherrypy
+from multiprocessing.pool import ThreadPool
 
 from wok.basemodel import Singleton
 from wok.config import config as kconfig
 from wok.config import get_version
+from wok.exception import NotFoundError
+from wok.utils import check_url_path, run_command, wok_log
+
 from ..config import find_qemu_binary
 from ..distroloader import DistroLoader
-from wok.exception import NotFoundError
-from debugreports import DebugReportsModel
-from featuretests import FeatureTests, FEATURETEST_POOL_NAME
-from featuretests import FEATURETEST_VM_NAME
 from ..repositories import Repositories
 from ..screenshot import VMScreenshot
 from ..swupdate import SoftwareUpdate
-from wok.utils import check_url_path, wok_log, run_command
+from debugreports import DebugReportsModel
+from featuretests import FeatureTests, FEATURETEST_POOL_NAME
+from featuretests import FEATURETEST_VM_NAME
 
 
 class ConfigModel(object):
diff --git a/plugins/kimchi/model/cpuinfo.py b/plugins/kimchi/model/cpuinfo.py
index 61d1ec6..5f4bbca 100644
--- a/plugins/kimchi/model/cpuinfo.py
+++ b/plugins/kimchi/model/cpuinfo.py
@@ -18,11 +18,11 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import platform
-
 from xml.etree import ElementTree as ET
 
 from wok.exception import InvalidParameter, InvalidOperation
-from wok.utils import wok_log, run_command
+from wok.utils import run_command, wok_log
+
 
 ARCH = 'power' if platform.machine().startswith('ppc') else 'x86'
 
diff --git a/plugins/kimchi/model/debugreports.py b/plugins/kimchi/model/debugreports.py
index aff2152..d20eb12 100644
--- a/plugins/kimchi/model/debugreports.py
+++ b/plugins/kimchi/model/debugreports.py
@@ -25,13 +25,14 @@ import shutil
 import subprocess
 import time
 
-from .. import config
-from wok.exception import InvalidParameter, WokException, NotFoundError
-from wok.exception import OperationFailed
-from tasks import TaskModel
+from wok.exception import InvalidParameter, NotFoundError, OperationFailed
+from wok.exception import WokException
 from wok.utils import add_task, wok_log
 from wok.utils import run_command
 
+from .. import config
+from tasks import TaskModel
+
 
 class DebugReportsModel(object):
     def __init__(self, **kargs):
diff --git a/plugins/kimchi/model/diskutils.py b/plugins/kimchi/model/diskutils.py
index 49bf17d..2f0c903 100644
--- a/plugins/kimchi/model/diskutils.py
+++ b/plugins/kimchi/model/diskutils.py
@@ -17,11 +17,11 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-
 from wok.exception import OperationFailed, NotFoundError
-from vms import VMModel, VMsModel
 from wok.utils import wok_log
+
 from ..xmlutils.disk import get_vm_disk_info, get_vm_disks
+from vms import VMModel, VMsModel
 
 """
     Functions that multiple storage-related models (e.g. VMStoragesModel,
diff --git a/plugins/kimchi/model/featuretests.py b/plugins/kimchi/model/featuretests.py
index eb41edb..c53d1aa 100644
--- a/plugins/kimchi/model/featuretests.py
+++ b/plugins/kimchi/model/featuretests.py
@@ -22,11 +22,11 @@ import libvirt
 import lxml.etree as ET
 import platform
 import subprocess
-
 from lxml.builder import E
 
 from wok.rollbackcontext import RollbackContext
-from wok.utils import wok_log, run_command, servermethod
+from wok.utils import run_command, servermethod, wok_log
+
 
 FEATURETEST_VM_NAME = "FEATURETEST_VM"
 FEATURETEST_POOL_NAME = "FEATURETEST_POOL"
diff --git a/plugins/kimchi/model/host.py b/plugins/kimchi/model/host.py
index 09b0a09..3ff034c 100644
--- a/plugins/kimchi/model/host.py
+++ b/plugins/kimchi/model/host.py
@@ -19,26 +19,26 @@
 
 import libvirt
 import os
-import time
 import platform
-from collections import defaultdict
-
 import psutil
+import time
 from cherrypy.process.plugins import BackgroundTask
+from collections import defaultdict
 
-from .. import disks
 from wok import netinfo
 from wok.basemodel import Singleton
-import hostdev
 from wok.exception import InvalidOperation, InvalidParameter
 from wok.exception import NotFoundError, OperationFailed
+from wok.utils import add_task, wok_log
+from wok.xmlutils.utils import xpath_get_text
+
+import hostdev
+from .. import disks
+from ..repositories import Repositories
+from ..swupdate import SoftwareUpdate
 from config import CapabilitiesModel
 from tasks import TaskModel
 from vms import DOM_STATE_MAP
-from ..repositories import Repositories
-from ..swupdate import SoftwareUpdate
-from wok.utils import add_task, wok_log
-from wok.xmlutils.utils import xpath_get_text
 
 
 HOST_STATS_INTERVAL = 1
diff --git a/plugins/kimchi/model/hostdev.py b/plugins/kimchi/model/hostdev.py
index 9ebc3c3..c411d0b 100644
--- a/plugins/kimchi/model/hostdev.py
+++ b/plugins/kimchi/model/hostdev.py
@@ -21,10 +21,11 @@ import os
 from pprint import pformat
 from pprint import pprint
 
-from libvirtconnection import LibvirtConnection
 from wok.utils import wok_log
 from wok.xmlutils.utils import dictize
 
+from libvirtconnection import LibvirtConnection
+
 
 def _get_all_host_dev_infos(libvirt_conn):
     node_devs = libvirt_conn.listAllDevices(0)
diff --git a/plugins/kimchi/model/interfaces.py b/plugins/kimchi/model/interfaces.py
index 5ccadc7..81b379a 100644
--- a/plugins/kimchi/model/interfaces.py
+++ b/plugins/kimchi/model/interfaces.py
@@ -19,6 +19,7 @@
 
 from wok import netinfo
 from wok.exception import NotFoundError
+
 from networks import NetworksModel
 
 
diff --git a/plugins/kimchi/model/libvirtconnection.py b/plugins/kimchi/model/libvirtconnection.py
index d2ce031..ef4a4ce 100644
--- a/plugins/kimchi/model/libvirtconnection.py
+++ b/plugins/kimchi/model/libvirtconnection.py
@@ -17,11 +17,10 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-import threading
-import time
-
 import cherrypy
 import libvirt
+import threading
+import time
 
 from wok.utils import wok_log
 
diff --git a/plugins/kimchi/model/libvirtstoragepool.py b/plugins/kimchi/model/libvirtstoragepool.py
index 6c1f031..b22856b 100644
--- a/plugins/kimchi/model/libvirtstoragepool.py
+++ b/plugins/kimchi/model/libvirtstoragepool.py
@@ -17,17 +17,17 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
+import libvirt
+import lxml.etree as ET
 import os
 import tempfile
-import lxml.etree as ET
 from lxml.builder import E
 
-import libvirt
-
 from wok.exception import InvalidParameter, OperationFailed, TimeoutExpired
-from ..iscsi import TargetClient
 from wok.rollbackcontext import RollbackContext
-from wok.utils import wok_log, parse_cmd_output, run_command
+from wok.utils import parse_cmd_output, run_command, wok_log
+
+from ..iscsi import TargetClient
 
 
 class StoragePoolDef(object):
diff --git a/plugins/kimchi/model/model.py b/plugins/kimchi/model/model.py
index 33dea12..0c94f63 100644
--- a/plugins/kimchi/model/model.py
+++ b/plugins/kimchi/model/model.py
@@ -21,10 +21,11 @@ import inspect
 import os
 
 from wok.basemodel import BaseModel
-from libvirtconnection import LibvirtConnection
 from wok.objectstore import ObjectStore
 from wok.utils import import_module, listPathModules
 
+from libvirtconnection import LibvirtConnection
+
 
 class Model(BaseModel):
     def __init__(self, libvirt_uri=None, objstore_loc=None):
diff --git a/plugins/kimchi/model/networks.py b/plugins/kimchi/model/networks.py
index 3723e4c..57af9e7 100644
--- a/plugins/kimchi/model/networks.py
+++ b/plugins/kimchi/model/networks.py
@@ -17,12 +17,10 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-import sys
-import time
-
 import ipaddr
 import libvirt
-
+import sys
+import time
 from xml.sax.saxutils import escape
 
 from wok import netinfo
@@ -30,12 +28,13 @@ from wok import network as knetwork
 from wok.config import PluginPaths
 from wok.exception import InvalidOperation, InvalidParameter
 from wok.exception import MissingParameter, NotFoundError, OperationFailed
-from ..osinfo import defaults as tmpl_defaults
 from wok.rollbackcontext import RollbackContext
-from wok.utils import wok_log, run_command
+from wok.utils import run_command, wok_log
+from wok.xmlutils.utils import xpath_get_text
+
+from ..osinfo import defaults as tmpl_defaults
 from ..xmlutils.network import create_vlan_tagged_bridge_xml
 from ..xmlutils.network import to_network_xml
-from wok.xmlutils.utils import xpath_get_text
 
 
 KIMCHI_BRIDGE_PREFIX = 'kb'
diff --git a/plugins/kimchi/model/peers.py b/plugins/kimchi/model/peers.py
index a9cf3b7..91e4a32 100644
--- a/plugins/kimchi/model/peers.py
+++ b/plugins/kimchi/model/peers.py
@@ -22,7 +22,7 @@ import re
 import socket
 
 from wok.config import config
-from wok.utils import wok_log, run_command
+from wok.utils import run_command, wok_log
 
 
 class PeersModel(object):
diff --git a/plugins/kimchi/model/storagepools.py b/plugins/kimchi/model/storagepools.py
index a0d10d9..b5b8d01 100644
--- a/plugins/kimchi/model/storagepools.py
+++ b/plugins/kimchi/model/storagepools.py
@@ -20,20 +20,20 @@
 import libvirt
 import lxml.etree as ET
 import sys
-
 from lxml.builder import E
 
 from wok.config import config, PluginPaths
-from ..scan import Scanner
 from wok.exception import InvalidOperation, MissingParameter
 from wok.exception import NotFoundError, OperationFailed
+from wok.utils import add_task, run_command, wok_log
+from wok.xmlutils.utils import xpath_get_text
+
+from ..osinfo import defaults as tmpl_defaults
+from ..scan import Scanner
+from ..utils import pool_name_from_uri
 from config import CapabilitiesModel
 from host import DeviceModel
 from libvirtstoragepool import StoragePoolDef
-from ..osinfo import defaults as tmpl_defaults
-from wok.utils import add_task, wok_log, run_command
-from ..utils import pool_name_from_uri
-from wok.xmlutils.utils import xpath_get_text
 
 
 ISO_POOL_NAME = u'kimchi_isos'
diff --git a/plugins/kimchi/model/storageservers.py b/plugins/kimchi/model/storageservers.py
index 17e1289..accc5f5 100644
--- a/plugins/kimchi/model/storageservers.py
+++ b/plugins/kimchi/model/storageservers.py
@@ -18,6 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 from wok.exception import NotFoundError
+
 from storagepools import StoragePoolModel, StoragePoolsModel
 
 # Types of remote storage servers supported
diff --git a/plugins/kimchi/model/storagetargets.py b/plugins/kimchi/model/storagetargets.py
index bbcfb0d..4090b45 100644
--- a/plugins/kimchi/model/storagetargets.py
+++ b/plugins/kimchi/model/storagetargets.py
@@ -22,9 +22,10 @@ import lxml.etree as ET
 from lxml import objectify
 from lxml.builder import E
 
+from wok.utils import patch_find_nfs_target, wok_log
+
 from config import CapabilitiesModel
 from storageservers import STORAGE_SERVERS
-from wok.utils import wok_log, patch_find_nfs_target
 
 
 class StorageTargetsModel(object):
diff --git a/plugins/kimchi/model/storagevolumes.py b/plugins/kimchi/model/storagevolumes.py
index 6bc203a..7fc0837 100644
--- a/plugins/kimchi/model/storagevolumes.py
+++ b/plugins/kimchi/model/storagevolumes.py
@@ -18,6 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import contextlib
+import libvirt
 import lxml.etree as ET
 import os
 import tempfile
@@ -26,18 +27,17 @@ import time
 import urllib2
 from lxml.builder import E
 
-import libvirt
-
-from ..config import READONLY_POOL_TYPE
 from wok.exception import InvalidOperation, InvalidParameter, IsoFormatError
 from wok.exception import MissingParameter, NotFoundError, OperationFailed
+from wok.utils import add_task, get_next_clone_name, get_unique_file_name
+from wok.utils import wok_log
+from wok.xmlutils.utils import xpath_get_text
+
+from ..config import READONLY_POOL_TYPE
 from ..isoinfo import IsoImage
 from diskutils import get_disk_used_by, set_disk_used_by
 from storagepools import StoragePoolModel
 from tasks import TaskModel
-from wok.utils import add_task, get_next_clone_name, get_unique_file_name
-from wok.utils import wok_log
-from wok.xmlutils.utils import xpath_get_text
 
 
 VOLUME_TYPE_MAP = {0: 'file',
diff --git a/plugins/kimchi/model/templates.py b/plugins/kimchi/model/templates.py
index a7a74fc..4f0b204 100644
--- a/plugins/kimchi/model/templates.py
+++ b/plugins/kimchi/model/templates.py
@@ -18,19 +18,19 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import copy
+import libvirt
 import os
 import stat
 
-import libvirt
-
 from wok.exception import InvalidOperation, InvalidParameter
 from wok.exception import NotFoundError, OperationFailed
+from wok.utils import probe_file_permission_as_user, run_setfacl_set_attr
+from wok.xmlutils.utils import xpath_get_text
+
 from ..kvmusertests import UserTests
-from cpuinfo import CPUInfoModel
 from ..utils import pool_name_from_uri
-from wok.utils import probe_file_permission_as_user, run_setfacl_set_attr
 from ..vmtemplate import VMTemplate
-from wok.xmlutils.utils import xpath_get_text
+from cpuinfo import CPUInfoModel
 
 
 class TemplatesModel(object):
diff --git a/plugins/kimchi/model/utils.py b/plugins/kimchi/model/utils.py
index 878390f..53d719d 100644
--- a/plugins/kimchi/model/utils.py
+++ b/plugins/kimchi/model/utils.py
@@ -23,6 +23,7 @@ from lxml.builder import E, ElementMaker
 
 from wok.exception import OperationFailed
 
+
 KIMCHI_META_URL = "https://github.com/kimchi-project/kimchi"
 KIMCHI_NAMESPACE = "kimchi"
 
diff --git a/plugins/kimchi/model/vmhostdevs.py b/plugins/kimchi/model/vmhostdevs.py
index 18f4e1f..0cc6bd3 100644
--- a/plugins/kimchi/model/vmhostdevs.py
+++ b/plugins/kimchi/model/vmhostdevs.py
@@ -18,21 +18,21 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import glob
-import os
-
 import libvirt
+import os
+import platform
 from lxml import etree, objectify
 from lxml.builder import E
 
 from wok.exception import InvalidOperation, InvalidParameter, NotFoundError
 from wok.exception import OperationFailed
+from wok.rollbackcontext import RollbackContext
+from wok.utils import run_command, wok_log
+
 from config import CapabilitiesModel
 from host import DeviceModel, DevicesModel
 from utils import get_vm_config_flag
 from vms import DOM_STATE_MAP, VMModel
-from wok.rollbackcontext import RollbackContext
-from wok.utils import wok_log, run_command
-import platform
 
 
 class VMHostDevsModel(object):
diff --git a/plugins/kimchi/model/vmifaces.py b/plugins/kimchi/model/vmifaces.py
index fe136e3..d51eb0f 100644
--- a/plugins/kimchi/model/vmifaces.py
+++ b/plugins/kimchi/model/vmifaces.py
@@ -17,16 +17,16 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-import random
-
 import libvirt
+import random
 from lxml import etree, objectify
 
 from wok.exception import InvalidOperation, MissingParameter
 from wok.exception import NotFoundError, InvalidOperation
+
+from ..xmlutils.interface import get_iface_xml
 from config import CapabilitiesModel
 from vms import DOM_STATE_MAP, VMModel
-from ..xmlutils.interface import get_iface_xml
 
 
 class VMIfacesModel(object):
diff --git a/plugins/kimchi/model/vms.py b/plugins/kimchi/model/vms.py
index 96e5084..561e7d8 100644
--- a/plugins/kimchi/model/vms.py
+++ b/plugins/kimchi/model/vms.py
@@ -17,39 +17,39 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-from lxml.builder import E
+import libvirt
 import lxml.etree as ET
-from lxml import etree, objectify
 import os
 import random
 import string
 import time
 import uuid
+from lxml import etree, objectify
+from lxml.builder import E
 from xml.etree import ElementTree
 
-import libvirt
-
 from wok import vnc
-from .. import model
 from wok.config import config
-from ..config import READONLY_POOL_TYPE
 from wok.exception import InvalidOperation, InvalidParameter
 from wok.exception import NotFoundError, OperationFailed
+from wok.rollbackcontext import RollbackContext
+from wok.utils import add_task, convert_data_size, get_next_clone_name
+from wok.utils import import_class, run_setfacl_set_attr, wok_log
+from wok.xmlutils.utils import xpath_get_text, xml_item_update
+from wok.xmlutils.utils import dictize
+
+from .. import model
+from ..config import READONLY_POOL_TYPE
 from ..kvmusertests import UserTests
+from ..screenshot import VMScreenshot
+from ..utils import template_name_from_uri
+from ..xmlutils.cpu import get_cpu_xml, get_numa_xml
 from config import CapabilitiesModel
 from tasks import TaskModel
 from templates import TemplateModel
 from utils import get_vm_name
 from utils import get_metadata_node
 from utils import set_metadata_node
-from wok.rollbackcontext import RollbackContext
-from ..screenshot import VMScreenshot
-from wok.utils import add_task, convert_data_size, get_next_clone_name
-from wok.utils import import_class, wok_log, run_setfacl_set_attr
-from ..utils import template_name_from_uri
-from ..xmlutils.cpu import get_cpu_xml, get_numa_xml
-from wok.xmlutils.utils import xpath_get_text, xml_item_update
-from wok.xmlutils.utils import dictize
 
 
 DOM_STATE_MAP = {0: 'nostate',
diff --git a/plugins/kimchi/model/vmsnapshots.py b/plugins/kimchi/model/vmsnapshots.py
index 0724adc..6abf726 100644
--- a/plugins/kimchi/model/vmsnapshots.py
+++ b/plugins/kimchi/model/vmsnapshots.py
@@ -17,19 +17,19 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-import time
-
 import libvirt
 import lxml.etree as ET
+import time
 from lxml import objectify
 from lxml.builder import E
 
 from wok.exception import InvalidOperation, NotFoundError, OperationFailed
+from wok.utils import add_task
+from wok.xmlutils.utils import xpath_get_text
+
 from tasks import TaskModel
 from vms import DOM_STATE_MAP, VMModel
 from vmstorages import VMStorageModel, VMStoragesModel
-from wok.utils import add_task
-from wok.xmlutils.utils import xpath_get_text
 
 
 class VMSnapshotsModel(object):
diff --git a/plugins/kimchi/model/vmstorages.py b/plugins/kimchi/model/vmstorages.py
index f7cef52..d6987e3 100644
--- a/plugins/kimchi/model/vmstorages.py
+++ b/plugins/kimchi/model/vmstorages.py
@@ -18,20 +18,21 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import string
-
 from lxml import etree
 
 from wok.exception import InvalidOperation, InvalidParameter, NotFoundError
 from wok.exception import OperationFailed
-from config import CapabilitiesModel
-from vms import DOM_STATE_MAP, VMModel
-from storagevolumes import StorageVolumeModel
-from utils import get_vm_config_flag
-from ..osinfo import lookup
-from diskutils import get_disk_used_by, set_disk_used_by
 from wok.utils import wok_log
+
+from ..osinfo import lookup
 from ..xmlutils.disk import get_device_node, get_disk_xml
 from ..xmlutils.disk import get_vm_disk_info, get_vm_disks
+from config import CapabilitiesModel
+from diskutils import get_disk_used_by, set_disk_used_by
+from storagevolumes import StorageVolumeModel
+from utils import get_vm_config_flag
+from vms import DOM_STATE_MAP, VMModel
+
 
 HOTPLUG_TYPE = ['scsi', 'virtio']
 
diff --git a/plugins/kimchi/osinfo.py b/plugins/kimchi/osinfo.py
index 5fe1e07..1164946 100644
--- a/plugins/kimchi/osinfo.py
+++ b/plugins/kimchi/osinfo.py
@@ -21,7 +21,6 @@ import copy
 import glob
 import os
 import psutil
-
 from collections import defaultdict
 from configobj import ConfigObj
 from distutils.version import LooseVersion
diff --git a/plugins/kimchi/repositories.py b/plugins/kimchi/repositories.py
index 926bd45..9caabc4 100644
--- a/plugins/kimchi/repositories.py
+++ b/plugins/kimchi/repositories.py
@@ -21,14 +21,14 @@ import copy
 import os
 import time
 import urlparse
-
 from ConfigParser import ConfigParser
 
 from wok.basemodel import Singleton
-from config import kimchiLock
 from wok.exception import InvalidOperation, InvalidParameter
 from wok.exception import OperationFailed, NotFoundError, MissingParameter
 from wok.utils import validate_repo_url
+
+from config import kimchiLock
 from yumparser import get_yum_repositories, write_repo_to_file
 
 
diff --git a/plugins/kimchi/root.py b/plugins/kimchi/root.py
index 9889926..20c41ca 100644
--- a/plugins/kimchi/root.py
+++ b/plugins/kimchi/root.py
@@ -21,14 +21,14 @@ import json
 import os
 import cherrypy
 
+from wok import vnc
+from wok.i18n import messages
+from wok.root import WokRoot
 
 import config
 import mockmodel
 from control import sub_nodes
-from wok.i18n import messages
 from model import model as kimchiModel
-from wok.root import WokRoot
-from wok import vnc
 
 
 class KimchiRoot(WokRoot):
diff --git a/plugins/kimchi/scan.py b/plugins/kimchi/scan.py
index 663b838..b475c46 100644
--- a/plugins/kimchi/scan.py
+++ b/plugins/kimchi/scan.py
@@ -25,9 +25,9 @@ import shutil
 import tempfile
 import time
 
+from wok.utils import wok_log
 
 from isoinfo import IsoImage, probe_iso
-from wok.utils import wok_log
 
 
 SCAN_IGNORE = ['/tmp/kimchi-scan-*']
diff --git a/plugins/kimchi/screenshot.py b/plugins/kimchi/screenshot.py
index 1cac964..7c2347c 100644
--- a/plugins/kimchi/screenshot.py
+++ b/plugins/kimchi/screenshot.py
@@ -25,16 +25,16 @@ import tempfile
 import time
 import uuid
 
-
 try:
     from PIL import Image
 except ImportError:
     import Image
 
 
-import config
 from wok.utils import wok_log
 
+import config
+
 
 (fd, pipe) = tempfile.mkstemp()
 stream_test_result = None
diff --git a/plugins/kimchi/swupdate.py b/plugins/kimchi/swupdate.py
index cd56707..84b927f 100644
--- a/plugins/kimchi/swupdate.py
+++ b/plugins/kimchi/swupdate.py
@@ -21,9 +21,10 @@ import subprocess
 import time
 
 from wok.basemodel import Singleton
-from config import kimchiLock
 from wok.exception import NotFoundError, OperationFailed
-from wok.utils import wok_log, run_command
+from wok.utils import run_command, wok_log
+
+from config import kimchiLock
 from yumparser import get_yum_packages_list_update
 
 
diff --git a/plugins/kimchi/tests/iso_gen.py b/plugins/kimchi/tests/iso_gen.py
index 7e92622..736c660 100644
--- a/plugins/kimchi/tests/iso_gen.py
+++ b/plugins/kimchi/tests/iso_gen.py
@@ -22,6 +22,7 @@ import struct
 
 from wok.plugins.kimchi.isoinfo import IsoImage
 
+
 iso_des = [
     ('openbsd', lambda v: True,
         lambda v: 'OpenBSD/i386    %s Install CD' % v),
diff --git a/plugins/kimchi/tests/test_authorization.py b/plugins/kimchi/tests/test_authorization.py
index 695b512..53aa847 100644
--- a/plugins/kimchi/tests/test_authorization.py
+++ b/plugins/kimchi/tests/test_authorization.py
@@ -20,10 +20,10 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
 from wok.plugins.kimchi import mockmodel
+
 from iso_gen import construct_fake_iso
 from utils import get_free_port, patch_auth, request
 from utils import run_server, wait_task
diff --git a/plugins/kimchi/tests/test_config.py.in b/plugins/kimchi/tests/test_config.py.in
index 930d6d3..0b9cc2a 100644
--- a/plugins/kimchi/tests/test_config.py.in
+++ b/plugins/kimchi/tests/test_config.py.in
@@ -20,9 +20,11 @@
 import unittest
 from cherrypy.lib.reprconf import Parser
 
-from wok.plugins.kimchi import config as kconfig
 from wok.config import Paths, PluginPaths
 
+from wok.plugins.kimchi import config as kconfig
+
+
 get_prefix = None
 
 
diff --git a/plugins/kimchi/tests/test_exception.py b/plugins/kimchi/tests/test_exception.py
index 32b6baf..d33b27f 100644
--- a/plugins/kimchi/tests/test_exception.py
+++ b/plugins/kimchi/tests/test_exception.py
@@ -21,9 +21,10 @@ import json
 import os
 import unittest
 
+import wok.server
 
 from wok.plugins.kimchi import mockmodel
-import wok.server
+
 from utils import get_free_port, patch_auth, request, run_server
 
 
diff --git a/plugins/kimchi/tests/test_host.py b/plugins/kimchi/tests/test_host.py
index 5a18490..e2aa196 100644
--- a/plugins/kimchi/tests/test_host.py
+++ b/plugins/kimchi/tests/test_host.py
@@ -25,12 +25,13 @@ import psutil
 import tempfile
 import time
 import unittest
-
 from functools import partial
 
 from wok.plugins.kimchi.mockmodel import MockModel
+
 from utils import get_free_port, patch_auth, request, run_server, wait_task
 
+
 test_server = None
 model = None
 host = None
diff --git a/plugins/kimchi/tests/test_mock_network.py b/plugins/kimchi/tests/test_mock_network.py
index 749b9c3..9f38869 100644
--- a/plugins/kimchi/tests/test_mock_network.py
+++ b/plugins/kimchi/tests/test_mock_network.py
@@ -21,10 +21,10 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
 from wok.plugins.kimchi.mockmodel import MockModel
+
 from test_model_network import _do_network_test
 from utils import get_free_port, patch_auth, request, run_server
 
diff --git a/plugins/kimchi/tests/test_mock_storagepool.py b/plugins/kimchi/tests/test_mock_storagepool.py
index b96d72d..6fe0981 100644
--- a/plugins/kimchi/tests/test_mock_storagepool.py
+++ b/plugins/kimchi/tests/test_mock_storagepool.py
@@ -21,10 +21,10 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
 from wok.plugins.kimchi.mockmodel import MockModel
+
 from utils import get_free_port, patch_auth, request, run_server
 
 
diff --git a/plugins/kimchi/tests/test_mock_storagevolume.py b/plugins/kimchi/tests/test_mock_storagevolume.py
index 0065305..22fcce1 100644
--- a/plugins/kimchi/tests/test_mock_storagevolume.py
+++ b/plugins/kimchi/tests/test_mock_storagevolume.py
@@ -21,10 +21,10 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
 from wok.plugins.kimchi.mockmodel import MockModel
+
 from test_model_storagevolume import _do_volume_test
 from utils import get_free_port, patch_auth, request, run_server
 
diff --git a/plugins/kimchi/tests/test_mockmodel.py b/plugins/kimchi/tests/test_mockmodel.py
index 133a61e..2fae0e2 100644
--- a/plugins/kimchi/tests/test_mockmodel.py
+++ b/plugins/kimchi/tests/test_mockmodel.py
@@ -23,11 +23,11 @@ import os
 import time
 import unittest
 
-
 from wok.plugins.kimchi import mockmodel
-from utils import get_free_port, patch_auth, request, run_server, wait_task
 from wok.plugins.kimchi.osinfo import get_template_default
 
+from utils import get_free_port, patch_auth, request, run_server, wait_task
+
 
 test_server = None
 model = None
diff --git a/plugins/kimchi/tests/test_model.py b/plugins/kimchi/tests/test_model.py
index 157ba62..c70e4fb 100644
--- a/plugins/kimchi/tests/test_model.py
+++ b/plugins/kimchi/tests/test_model.py
@@ -27,20 +27,21 @@ import time
 import unittest
 import uuid
 
-
-import iso_gen
 import wok.objectstore
-import utils
 from wok import netinfo
 from wok.basemodel import Singleton
 from wok.config import config
 from wok.exception import InvalidOperation
 from wok.exception import InvalidParameter, NotFoundError, OperationFailed
+from wok.rollbackcontext import RollbackContext
+from wok.utils import add_task
+
 from wok.plugins.kimchi.osinfo import get_template_default
 from wok.plugins.kimchi.model import model
 from wok.plugins.kimchi.model.libvirtconnection import LibvirtConnection
-from wok.rollbackcontext import RollbackContext
-from wok.utils import add_task
+
+import iso_gen
+import utils
 
 
 invalid_repository_urls = ['www.fedora.org',       # missing protocol
diff --git a/plugins/kimchi/tests/test_model_network.py b/plugins/kimchi/tests/test_model_network.py
index 37f5652..8874ed9 100644
--- a/plugins/kimchi/tests/test_model_network.py
+++ b/plugins/kimchi/tests/test_model_network.py
@@ -21,11 +21,12 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
-from wok.plugins.kimchi.model.model import Model
 from wok.rollbackcontext import RollbackContext
+
+from wok.plugins.kimchi.model.model import Model
+
 from utils import get_free_port, patch_auth, request, rollback_wrapper
 from utils import run_server
 
diff --git a/plugins/kimchi/tests/test_model_storagepool.py b/plugins/kimchi/tests/test_model_storagepool.py
index 1326731..297b0b7 100644
--- a/plugins/kimchi/tests/test_model_storagepool.py
+++ b/plugins/kimchi/tests/test_model_storagepool.py
@@ -21,11 +21,12 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
-from wok.plugins.kimchi.model.model import Model
 from wok.rollbackcontext import RollbackContext
+
+from wok.plugins.kimchi.model.model import Model
+
 from utils import get_free_port, patch_auth, request
 from utils import run_server
 
diff --git a/plugins/kimchi/tests/test_model_storagevolume.py b/plugins/kimchi/tests/test_model_storagevolume.py
index 103948e..a05e479 100644
--- a/plugins/kimchi/tests/test_model_storagevolume.py
+++ b/plugins/kimchi/tests/test_model_storagevolume.py
@@ -22,14 +22,15 @@ import json
 import os
 import requests
 import unittest
-
 from functools import partial
 
 from wok.config import paths
+from wok.rollbackcontext import RollbackContext
+
 from wok.plugins.kimchi.config import READONLY_POOL_TYPE
-from wok.plugins.kimchi.model.model import Model
 from wok.plugins.kimchi.mockmodel import MockModel
-from wok.rollbackcontext import RollbackContext
+from wok.plugins.kimchi.model.model import Model
+
 from utils import fake_auth_header, get_free_port, patch_auth, request
 from utils import rollback_wrapper, run_server, wait_task
 
diff --git a/plugins/kimchi/tests/test_networkxml.py b/plugins/kimchi/tests/test_networkxml.py
index 139f051..a64b6c2 100644
--- a/plugins/kimchi/tests/test_networkxml.py
+++ b/plugins/kimchi/tests/test_networkxml.py
@@ -18,13 +18,14 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 import ipaddr
-import unittest
 import lxml.etree as ET
+import unittest
 
-import utils
+from wok.xmlutils.utils import xpath_get_text
 
 from wok.plugins.kimchi.xmlutils import network as nxml
-from wok.xmlutils.utils import xpath_get_text
+
+import utils
 
 
 class NetworkXmlTests(unittest.TestCase):
diff --git a/plugins/kimchi/tests/test_objectstore.py b/plugins/kimchi/tests/test_objectstore.py
index 412a7f2..632786f 100644
--- a/plugins/kimchi/tests/test_objectstore.py
+++ b/plugins/kimchi/tests/test_objectstore.py
@@ -23,8 +23,9 @@ import tempfile
 import threading
 import unittest
 
-from wok.exception import NotFoundError
 from wok import objectstore
+from wok.exception import NotFoundError
+
 
 tmpfile = None
 
diff --git a/plugins/kimchi/tests/test_osinfo.py b/plugins/kimchi/tests/test_osinfo.py
index 1712ded..bd2af58 100644
--- a/plugins/kimchi/tests/test_osinfo.py
+++ b/plugins/kimchi/tests/test_osinfo.py
@@ -19,7 +19,6 @@
 
 import unittest
 
-
 from wok.plugins.kimchi.osinfo import _get_arch, get_template_default, lookup
 from wok.plugins.kimchi.osinfo import modern_version_bases
 
diff --git a/plugins/kimchi/tests/test_plugin.py b/plugins/kimchi/tests/test_plugin.py
index 2f2475a..ebc4a39 100644
--- a/plugins/kimchi/tests/test_plugin.py
+++ b/plugins/kimchi/tests/test_plugin.py
@@ -20,14 +20,13 @@
 import json
 import os
 import unittest
-
-
 from functools import partial
 
-
-from wok.plugins.kimchi import mockmodel
 import wok.server
 from wok.utils import get_enabled_plugins
+
+from wok.plugins.kimchi import mockmodel
+
 import utils
 
 
diff --git a/plugins/kimchi/tests/test_rest.py b/plugins/kimchi/tests/test_rest.py
index 69db7a7..3b15dee 100644
--- a/plugins/kimchi/tests/test_rest.py
+++ b/plugins/kimchi/tests/test_rest.py
@@ -25,15 +25,16 @@ import time
 import unittest
 import urllib2
 import urlparse
-
 from functools import partial
 
-import iso_gen
-from wok.plugins.kimchi import mockmodel
 import wok.server
-from wok.plugins.kimchi.osinfo import get_template_default
 from wok.rollbackcontext import RollbackContext
 from wok.utils import add_task
+
+from wok.plugins.kimchi import mockmodel
+from wok.plugins.kimchi.osinfo import get_template_default
+
+import iso_gen
 from utils import get_free_port, patch_auth, request
 from utils import run_server, wait_task
 
diff --git a/plugins/kimchi/tests/test_server.py b/plugins/kimchi/tests/test_server.py
index 48a8589..d7f1af0 100644
--- a/plugins/kimchi/tests/test_server.py
+++ b/plugins/kimchi/tests/test_server.py
@@ -24,13 +24,15 @@ import os
 import tempfile
 import threading
 import unittest
-
 from functools import partial
 
-import utils
-from wok.plugins.kimchi import mockmodel
 from wok.control.base import Collection, Resource
 
+from wok.plugins.kimchi import mockmodel
+
+import utils
+
+
 test_server = None
 model = None
 host = None
diff --git a/plugins/kimchi/tests/test_template.py b/plugins/kimchi/tests/test_template.py
index a1a828b..39adeb1 100644
--- a/plugins/kimchi/tests/test_template.py
+++ b/plugins/kimchi/tests/test_template.py
@@ -21,11 +21,11 @@
 import json
 import os
 import unittest
-
 from functools import partial
 
 from wok.plugins.kimchi.config import READONLY_POOL_TYPE
 from wok.plugins.kimchi.mockmodel import MockModel
+
 from utils import get_free_port, patch_auth, request, run_server
 
 
diff --git a/plugins/kimchi/tests/test_vmtemplate.py b/plugins/kimchi/tests/test_vmtemplate.py
index 6213900..0bca215 100644
--- a/plugins/kimchi/tests/test_vmtemplate.py
+++ b/plugins/kimchi/tests/test_vmtemplate.py
@@ -21,10 +21,10 @@ import os
 import unittest
 import uuid
 
+from wok.xmlutils.utils import xpath_get_text
 
 from wok.plugins.kimchi.osinfo import get_template_default
 from wok.plugins.kimchi.vmtemplate import VMTemplate
-from wok.xmlutils.utils import xpath_get_text
 
 
 class VMTemplateTests(unittest.TestCase):
diff --git a/plugins/kimchi/tests/test_yumparser.py b/plugins/kimchi/tests/test_yumparser.py
index 8dd16b0..b7d7d89 100644
--- a/plugins/kimchi/tests/test_yumparser.py
+++ b/plugins/kimchi/tests/test_yumparser.py
@@ -21,12 +21,13 @@ import os
 import tempfile
 import unittest
 
-from wok.plugins.kimchi.model import model
 from wok.rollbackcontext import RollbackContext
+
+from wok.plugins.kimchi.model import model
 from wok.plugins.kimchi.yumparser import delete_repo_from_file, get_repo_files
 from wok.plugins.kimchi.yumparser import get_yum_packages_list_update
-from wok.plugins.kimchi.yumparser import get_yum_repositories, write_repo_to_file
-from wok.plugins.kimchi.yumparser import YumRepoObject
+from wok.plugins.kimchi.yumparser import get_yum_repositories
+from wok.plugins.kimchi.yumparser import write_repo_to_file, YumRepoObject
 
 
 TEMP_REPO_FILE = ''
diff --git a/plugins/kimchi/tests/utils.py b/plugins/kimchi/tests/utils.py
index e224062..aef2c04 100644
--- a/plugins/kimchi/tests/utils.py
+++ b/plugins/kimchi/tests/utils.py
@@ -28,21 +28,21 @@ import os
 import socket
 import ssl
 import sys
-import time
 import threading
+import time
 import unittest
-
 from contextlib import closing
 from lxml import etree
 
-
-from wok.plugins.kimchi import mockmodel
 import wok.server
 from wok.config import config, paths, PluginPaths
 from wok.auth import User, USER_NAME, USER_GROUPS, USER_ROLES, tabs
 from wok.exception import NotFoundError, OperationFailed
 from wok.utils import wok_log
 
+from wok.plugins.kimchi import mockmodel
+
+
 _ports = {}
 
 # provide missing unittest decorators and API for python 2.6; these decorators
diff --git a/plugins/kimchi/vmtemplate.py b/plugins/kimchi/vmtemplate.py
index f45f80d..07e70ba 100644
--- a/plugins/kimchi/vmtemplate.py
+++ b/plugins/kimchi/vmtemplate.py
@@ -22,16 +22,16 @@ import stat
 import time
 import urlparse
 import uuid
-
 from lxml import etree
 from lxml.builder import E
 
+from wok.exception import InvalidParameter, ImageFormatError, IsoFormatError
+from wok.exception import MissingParameter, OperationFailed
+from wok.utils import check_url_path
+
 import imageinfo
 import osinfo
-from wok.exception import InvalidParameter, IsoFormatError, MissingParameter
-from wok.exception import ImageFormatError, OperationFailed
 from isoinfo import IsoImage
-from wok.utils import check_url_path
 from utils import pool_name_from_uri
 from xmlutils.cpu import get_cpu_xml
 from xmlutils.disk import get_disk_xml
diff --git a/plugins/kimchi/xmlutils/disk.py b/plugins/kimchi/xmlutils/disk.py
index a451c43..126ce77 100644
--- a/plugins/kimchi/xmlutils/disk.py
+++ b/plugins/kimchi/xmlutils/disk.py
@@ -23,13 +23,13 @@ import socket
 import stat
 import string
 import urlparse
-
 from lxml import objectify
 from lxml.builder import E
 
 from wok.exception import InvalidParameter, NotFoundError
 from wok.utils import check_url_path
 
+
 BUS_TO_DEV_MAP = {'ide': 'hd', 'virtio': 'vd', 'scsi': 'sd'}
 DEV_TYPE_SRC_ATTR_MAP = {'file': 'file', 'block': 'dev'}
 
diff --git a/plugins/kimchi/xmlutils/graphics.py b/plugins/kimchi/xmlutils/graphics.py
index 53cba09..2b4346a 100644
--- a/plugins/kimchi/xmlutils/graphics.py
+++ b/plugins/kimchi/xmlutils/graphics.py
@@ -18,7 +18,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import lxml.etree as ET
-
 from lxml.builder import E
 
 
diff --git a/plugins/kimchi/xmlutils/interface.py b/plugins/kimchi/xmlutils/interface.py
index 70b63bd..0f3e848 100644
--- a/plugins/kimchi/xmlutils/interface.py
+++ b/plugins/kimchi/xmlutils/interface.py
@@ -18,7 +18,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import lxml.etree as ET
-
 from distutils.version import LooseVersion
 from lxml.builder import E
 
diff --git a/plugins/kimchi/xmlutils/network.py b/plugins/kimchi/xmlutils/network.py
index e78779c..c73aad9 100644
--- a/plugins/kimchi/xmlutils/network.py
+++ b/plugins/kimchi/xmlutils/network.py
@@ -19,7 +19,6 @@
 
 import ipaddr
 import lxml.etree as ET
-
 from lxml.builder import E
 
 
diff --git a/plugins/kimchi/yumparser.py b/plugins/kimchi/yumparser.py
index 8151f86..654b4b2 100644
--- a/plugins/kimchi/yumparser.py
+++ b/plugins/kimchi/yumparser.py
@@ -16,8 +16,8 @@
 # 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
-import subprocess
 
+import subprocess
 from os import listdir
 from os.path import isfile, splitext
 
diff --git a/plugins/sample/__init__.py b/plugins/sample/__init__.py
index a2cfbf2..a3a8f05 100644
--- a/plugins/sample/__init__.py
+++ b/plugins/sample/__init__.py
@@ -19,14 +19,14 @@
 
 import json
 import os
-
-
 from cherrypy import expose
 
 
 from wok.config import PluginPaths
 from wok.control.base import Collection, Resource
 from wok.root import WokRoot
+
+
 from plugins.sample.i18n import messages
 from plugins.sample.model import Model
 
diff --git a/plugins/sample/model.py b/plugins/sample/model.py
index 8edcc85..4ada648 100644
--- a/plugins/sample/model.py
+++ b/plugins/sample/model.py
@@ -17,8 +17,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-from wok.exception import InvalidOperation, NotFoundError
 from wok.basemodel import BaseModel
+from wok.exception import InvalidOperation, NotFoundError
 
 
 class CirclesModel(object):
diff --git a/src/wok/config.py.in b/src/wok/config.py.in
index 2935c40..ab0f83b 100644
--- a/src/wok/config.py.in
+++ b/src/wok/config.py.in
@@ -19,8 +19,6 @@
 #
 
 import os
-
-
 from ConfigParser import SafeConfigParser
 
 
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index 65a6fee..5242f51 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -28,8 +28,8 @@ from wok.control.utils import get_class_name, internal_redirect, model_fn
 from wok.control.utils import parse_request, validate_method
 from wok.control.utils import validate_params
 from wok.exception import InvalidOperation, InvalidParameter
-from wok.exception import WokException, MissingParameter, NotFoundError
-from wok.exception import OperationFailed, UnauthorizedError
+from wok.exception import MissingParameter, NotFoundError
+from wok.exception import OperationFailed, UnauthorizedError, WokException
 
 
 class Resource(object):
diff --git a/src/wok/control/utils.py b/src/wok/control/utils.py
index d617dcd..496320c 100644
--- a/src/wok/control/utils.py
+++ b/src/wok/control/utils.py
@@ -20,8 +20,6 @@
 
 import cherrypy
 import json
-
-
 from jsonschema import Draft3Validator, ValidationError, FormatChecker
 
 
diff --git a/src/wok/objectstore.py b/src/wok/objectstore.py
index 87a30d1..107b568 100644
--- a/src/wok/objectstore.py
+++ b/src/wok/objectstore.py
@@ -21,7 +21,6 @@ import sqlite3
 import threading
 import traceback
 
-
 try:
     from collections import OrderedDict
 except ImportError:
diff --git a/src/wok/root.py b/src/wok/root.py
index 35620c7..3a86a74 100644
--- a/src/wok/root.py
+++ b/src/wok/root.py
@@ -20,9 +20,8 @@
 import cherrypy
 import json
 import os
-
-
 from distutils.version import LooseVersion
+
 from wok import auth
 from wok import template
 from wok.i18n import messages
diff --git a/src/wok/server.py b/src/wok/server.py
index 0a836a2..5b48049 100644
--- a/src/wok/server.py
+++ b/src/wok/server.py
@@ -25,9 +25,9 @@ import os
 
 from wok import auth
 from wok import config
-from wok.model import model
 from wok.config import WokConfig, PluginConfig
 from wok.control import sub_nodes
+from wok.model import model
 from wok.proxy import start_proxy, terminate_proxy
 from wok.root import WokRoot
 from wok.utils import get_enabled_plugins, import_class
diff --git a/src/wok/sslcert.py b/src/wok/sslcert.py
index e772dc8..6b64796 100644
--- a/src/wok/sslcert.py
+++ b/src/wok/sslcert.py
@@ -22,8 +22,6 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 import time
-
-
 from M2Crypto import ASN1, EVP, RSA, X509
 
 
diff --git a/src/wok/template.py b/src/wok/template.py
index 323bf55..c743f73 100644
--- a/src/wok/template.py
+++ b/src/wok/template.py
@@ -20,11 +20,11 @@
 import cherrypy
 import errno
 import json
+from Cheetah.Template import Template
+from glob import iglob
 
 
 from wok.config import paths
-from Cheetah.Template import Template
-from glob import iglob
 
 
 def get_lang():
diff --git a/src/wok/utils.py b/src/wok/utils.py
index fa379d4..a5083af 100644
--- a/src/wok/utils.py
+++ b/src/wok/utils.py
@@ -29,11 +29,11 @@ import subprocess
 import traceback
 import urllib2
 import xml.etree.ElementTree as ET
+from cherrypy.lib.reprconf import Parser
 from httplib import HTTPConnection, HTTPException
 from multiprocessing import Process, Queue
 from threading import Timer
 from urlparse import urlparse
-from cherrypy.lib.reprconf import Parser
 
 from wok.asynctask import AsyncTask
 from wok.config import paths, PluginPaths
diff --git a/src/wok/vnc.py b/src/wok/vnc.py
index 3b6a80b..2532449 100644
--- a/src/wok/vnc.py
+++ b/src/wok/vnc.py
@@ -21,7 +21,6 @@
 import base64
 import errno
 import os
-
 from multiprocessing import Process
 from websockify import WebSocketProxy
 
-- 
1.7.1




More information about the Kimchi-devel mailing list