[Kimchi-devel] [PATCH 2/4] Remove unused imports

Aline Manera alinefm at linux.vnet.ibm.com
Mon Jan 20 15:32:28 UTC 2014


On 01/15/2014 12:05 AM, Crístian Viana wrote:
> If an import module is not used in that file, there is no need to
> have it.
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
>   src/kimchi/control/plugins.py |  2 +-
>   src/kimchi/featuretests.py    |  3 ---
>   src/kimchi/mockmodel.py       |  3 ---
>   src/kimchi/model.py           | 11 +----------
>   src/kimchi/screenshot.py      |  1 -
>   src/kimchi/template.py        |  1 -
>   src/kimchi/vmtemplate.py      |  2 --
>   tests/test_exception.py       |  1 -
>   tests/test_plugin.py          |  1 -
>   tests/test_rest.py            |  1 -
>   tests/test_server.py          |  1 -
>   11 files changed, 2 insertions(+), 25 deletions(-)
>
> diff --git a/src/kimchi/control/plugins.py b/src/kimchi/control/plugins.py
> index af32709..dcfa857 100644
> --- a/src/kimchi/control/plugins.py
> +++ b/src/kimchi/control/plugins.py
> @@ -23,7 +23,7 @@
>   # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
>   
>   import kimchi.template
> -from kimchi.control.base import Collection, Resource
> +from kimchi.control.base import Collection
>   from kimchi.control.utils import get_class_name, model_fn
>   
>   
> diff --git a/src/kimchi/featuretests.py b/src/kimchi/featuretests.py
> index e8d654d..9fc709a 100644
> --- a/src/kimchi/featuretests.py
> +++ b/src/kimchi/featuretests.py
> @@ -20,7 +20,6 @@
>   # 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 os
>   import subprocess
>   import threading
>   
> @@ -28,8 +27,6 @@ import threading
>   import cherrypy
>   import libvirt
>   
> -from kimchi import config
> -
>   
>   ISO_STREAM_XML = """
>   <domain type='kvm'>
> diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
> index 494a757..544b7de 100644
> --- a/src/kimchi/mockmodel.py
> +++ b/src/kimchi/mockmodel.py
> @@ -27,7 +27,6 @@ import ipaddr
>   import os
>   import psutil
>   import random
> -import subprocess
>   import time
>   import uuid
>   
> @@ -44,14 +43,12 @@ import cherrypy
>   
>   import kimchi.model
>   from kimchi import config
> -from kimchi import network as knetwork
>   from kimchi.asynctask import AsyncTask
>   from kimchi.distroloader import DistroLoader
>   from kimchi.exception import InvalidOperation, InvalidParameter
>   from kimchi.exception import MissingParameter, NotFoundError, OperationFailed
>   from kimchi.objectstore import ObjectStore
>   from kimchi.screenshot import VMScreenshot
> -from kimchi.utils import is_digit
>   from kimchi.vmtemplate import VMTemplate
>   
>   
> diff --git a/src/kimchi/model.py b/src/kimchi/model.py
> index 0125a93..f64a5fd 100644
> --- a/src/kimchi/model.py
> +++ b/src/kimchi/model.py
> @@ -23,10 +23,8 @@
>   import copy
>   import disks
>   import fnmatch
> -import functools
>   import glob
>   import ipaddr
> -import json
>   import libvirt
>   import logging
>   import os
> @@ -43,15 +41,8 @@ from collections import defaultdict
>   from xml.etree import ElementTree
>   
>   
> -try:
> -    from collections import OrderedDict
> -except ImportError:
> -    from ordereddict import OrderedDict
> -
> -

If OrderedDict is not used anymore we also can update the README/spec 
files and remove it from dependencies list.

>   import cherrypy
>   from cherrypy.process.plugins import BackgroundTask
> -from cherrypy.process.plugins import SimplePlugin
>   
>   
>   from kimchi import config
> @@ -70,7 +61,7 @@ from kimchi.isoinfo import IsoImage
>   from kimchi.objectstore import ObjectStore
>   from kimchi.scan import Scanner
>   from kimchi.screenshot import VMScreenshot
> -from kimchi.utils import get_enabled_plugins, is_digit, kimchi_log
> +from kimchi.utils import get_enabled_plugins, kimchi_log
>   from kimchi.vmtemplate import VMTemplate
>   
>   
> diff --git a/src/kimchi/screenshot.py b/src/kimchi/screenshot.py
> index 5cfea96..e65a752 100644
> --- a/src/kimchi/screenshot.py
> +++ b/src/kimchi/screenshot.py
> @@ -23,7 +23,6 @@
>   
>   import glob
>   import os
> -import random
>   import signal
>   import tempfile
>   import time
> diff --git a/src/kimchi/template.py b/src/kimchi/template.py
> index 3f94d24..adc9c62 100644
> --- a/src/kimchi/template.py
> +++ b/src/kimchi/template.py
> @@ -23,7 +23,6 @@
>   
>   import errno
>   import json
> -import os
>   
>   
>   import cherrypy
> diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
> index 6587bbb..9097a05 100644
> --- a/src/kimchi/vmtemplate.py
> +++ b/src/kimchi/vmtemplate.py
> @@ -23,11 +23,9 @@
>   import os
>   import string
>   import socket
> -import urllib
>   import urlparse
>   
>   
> -from kimchi import isoinfo
>   from kimchi import osinfo
>   from kimchi.exception import InvalidParameter, IsoFormatError
>   from kimchi.isoinfo import IsoImage
> diff --git a/tests/test_exception.py b/tests/test_exception.py
> index df1f507..2757a11 100644
> --- a/tests/test_exception.py
> +++ b/tests/test_exception.py
> @@ -26,7 +26,6 @@ import unittest
>   
>   
>   import kimchi.mockmodel
> -import kimchi.server
>   from utils import get_free_port, patch_auth, request, run_server
>   
>   
> diff --git a/tests/test_plugin.py b/tests/test_plugin.py
> index f12b11f..1afec63 100644
> --- a/tests/test_plugin.py
> +++ b/tests/test_plugin.py
> @@ -28,7 +28,6 @@ from functools import partial
>   
>   
>   import kimchi.mockmodel
> -import kimchi.server
>   import utils
>   from kimchi import config
>   
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index 89bc616..50542e4 100644
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -29,7 +29,6 @@ from functools import partial
>   
>   
>   import kimchi.mockmodel
> -import kimchi.server
>   from kimchi.rollbackcontext import RollbackContext
>   from utils import fake_user, get_free_port, https_request, patch_auth, request
>   from utils import run_server
> diff --git a/tests/test_server.py b/tests/test_server.py
> index adbf770..0050f6a 100644
> --- a/tests/test_server.py
> +++ b/tests/test_server.py
> @@ -20,7 +20,6 @@
>   # 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 json
>   import os
>   import unittest
>   




More information about the Kimchi-devel mailing list