[virt-tools-list] [virt-manager PATCH 2/4] pep8 E402: module level import not at top of file

Pavel Hrdina phrdina at redhat.com
Fri Jul 10 12:07:01 UTC 2015


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 setup.py               |  3 ++-
 tests/__init__.py      |  8 +++++---
 virtManager/viewers.py |  6 ++++--
 virtinst/__init__.py   | 34 +++++++++++++++++-----------------
 4 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/setup.py b/setup.py
index 9454977..5cad0a0 100755
--- a/setup.py
+++ b/setup.py
@@ -13,13 +13,14 @@ from distutils.command.install import install
 from distutils.command.install_egg_info import install_egg_info
 from distutils.command.sdist import sdist
 from distutils.sysconfig import get_config_var
-sysprefix = get_config_var("prefix")
 
 from virtcli import CLIConfig
 
+sysprefix = get_config_var("prefix")
 
 # pylint: disable=attribute-defined-outside-init
 
+
 def _generate_potfiles_in():
     def find(dirname, ext):
         ret = []
diff --git a/tests/__init__.py b/tests/__init__.py
index 45aaf21..d69537d 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -20,16 +20,18 @@ import imp
 import logging
 import os
 
+from virtcli import cliconfig
+
+from tests import utils
+
+
 os.environ["VIRTINST_TEST_SUITE"] = "1"
 os.environ["VIRTINST_TEST_URL_DIR"] = os.path.abspath(
     "tests/cli-test-xml/fakefedoratree/")
 
-from virtcli import cliconfig
 # This sets all the cli bits back to their defaults
 reload(cliconfig)
 
-from tests import utils
-
 # Setup logging
 rootLogger = logging.getLogger()
 for handler in rootLogger.handlers:
diff --git a/virtManager/viewers.py b/virtManager/viewers.py
index f2b6d69..6099182 100644
--- a/virtManager/viewers.py
+++ b/virtManager/viewers.py
@@ -23,9 +23,7 @@ from gi.repository import GObject
 from gi.repository import Gdk
 
 import gi
-gi.require_version('GtkVnc', '2.0')
 from gi.repository import GtkVnc
-gi.require_version('SpiceClientGtk', '3.0')
 from gi.repository import SpiceClientGtk
 from gi.repository import SpiceClientGLib
 
@@ -36,6 +34,10 @@ from .baseclass import vmmGObject
 from .sshtunnels import SSHTunnels
 
 
+gi.require_version('GtkVnc', '2.0')
+gi.require_version('SpiceClientGtk', '3.0')
+
+
 ##################################
 # VNC/Spice abstraction handling #
 ##################################
diff --git a/virtinst/__init__.py b/virtinst/__init__.py
index c87a222..b1b671f 100644
--- a/virtinst/__init__.py
+++ b/virtinst/__init__.py
@@ -17,23 +17,6 @@
 
 from virtcli import CLIConfig as _CLIConfig
 
-
-def _setup_i18n():
-    import gettext
-    import locale
-
-    try:
-        locale.setlocale(locale.LC_ALL, '')
-    except:
-        # Can happen if user passed a bogus LANG
-        pass
-
-    gettext.install("virt-manager", _CLIConfig.gettext_dir)
-    gettext.bindtextdomain("virt-manager", _CLIConfig.gettext_dir)
-
-_setup_i18n()
-stable_defaults = _CLIConfig.stable_defaults
-
 from . import util
 from virtinst import support
 from virtinst.uri import URISplit
@@ -91,3 +74,20 @@ from virtinst.cloner import Cloner
 from virtinst.snapshot import DomainSnapshot
 
 from virtinst.connection import VirtualConnection
+
+
+def _setup_i18n():
+    import gettext
+    import locale
+
+    try:
+        locale.setlocale(locale.LC_ALL, '')
+    except:
+        # Can happen if user passed a bogus LANG
+        pass
+
+    gettext.install("virt-manager", _CLIConfig.gettext_dir)
+    gettext.bindtextdomain("virt-manager", _CLIConfig.gettext_dir)
+
+_setup_i18n()
+stable_defaults = _CLIConfig.stable_defaults
-- 
2.4.5




More information about the virt-tools-list mailing list