[elbe-devel] [PATCH 24/25] pylint: fixup import order so that pylint stops complaining

Torben Hohn torben.hohn at linutronix.de
Wed Aug 22 10:42:25 CEST 2018


pylint complains:
--------------------------------------------------------------------------------------------------------------------------------------------
************* Module elbepack.finetuning
elbepack/finetuning.py:15: [C0411(wrong-import-order), ] standard import "from shutil import rmtree" comes before "from apt.package import FetchError"
elbepack/finetuning.py:16: [C0411(wrong-import-order), ] standard import "from io import BytesIO" comes before "from apt.package import FetchError"
************* Module elbepack.rpcaptcache
elbepack/rpcaptcache.py:12: [C0411(wrong-import-order), ] standard import "from multiprocessing.managers import BaseManager" comes before "from apt_pkg import config, version_compare"
************* Module elbepack.updated
elbepack/updated.py:29: [C0411(wrong-import-order), ] standard import "from zipfile import ZipFile, BadZipfile" comes before "from spyne import Application"
************* Module elbepack.version
elbepack/version.py:8: [C0411(wrong-import-order), ] standard import "from platform import linux_distribution" comes before "from elbepack.directories import pack_dir"
************* Module elbepack.soapclient
elbepack/soapclient.py:21: [C0411(wrong-import-order), ] standard import "from datetime import datetime" comes before "from suds.client import Client"
elbepack/soapclient.py:22: [C0411(wrong-import-order), ] standard import "from urllib2 import URLError" comes before "from suds.client import Client"
elbepack/soapclient.py:23: [C0411(wrong-import-order), ] standard import "from httplib import BadStatusLine" comes before "from suds.client import Client"
************* Module elbepack.elbexml
elbepack/elbexml.py:17: [C0411(wrong-import-order), ] standard import "from base64 import standard_b64decode" comes before "from elbepack.treeutils import etree"
elbepack/elbexml.py:18: [C0411(wrong-import-order), ] standard import "from tempfile import NamedTemporaryFile" comes before "from elbepack.treeutils import etree"
************* Module elbepack.dump
elbepack/dump.py:9: [C0411(wrong-import-order), ] standard import "from datetime import datetime" comes before "from elbepack.asciidoclog import ASCIIDocLog"
************* Module elbepack.commands.show
elbepack/commands/show.py:14: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.prjrepo
elbepack/commands/prjrepo.py:15: [C0411(wrong-import-order), ] standard import "from urllib2 import URLError" comes before "from suds import WebFault"
elbepack/commands/prjrepo.py:16: [C0411(wrong-import-order), ] standard import "from httplib import BadStatusLine" comes before "from suds import WebFault"
************* Module elbepack.commands.get_archive
elbepack/commands/get_archive.py:15: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.xsdtoasciidoc
elbepack/commands/xsdtoasciidoc.py:15: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.init
elbepack/commands/init.py:23: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.pin_versions
elbepack/commands/pin_versions.py:12: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.add
elbepack/commands/add.py:11: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.elbexml import ElbeXML"
************* Module elbepack.commands.check_updates
elbepack/commands/check_updates.py:16: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.setsel
elbepack/commands/setsel.py:12: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.treeutils import etree"
************* Module elbepack.commands.chg_archive
elbepack/commands/chg_archive.py:13: [C0411(wrong-import-order), ] standard import "from optparse import OptionParser" comes before "from elbepack.archivedir import chg_archive"
************* Module elbepack.commands.control
elbepack/commands/control.py:15: [C0411(wrong-import-order), ] standard import "from urllib2 import URLError" comes before "from suds import WebFault"
elbepack/commands/control.py:16: [C0411(wrong-import-order), ] standard import "from httplib import BadStatusLine" comes before "from suds import WebFault"
************* Module elbepack.daemons.soap.faults
elbepack/daemons/soap/faults.py:8: [C0411(wrong-import-order), ] standard import "from traceback import format_exc" comes before "from spyne.model.fault import Fault"
elbepack/daemons/soap/faults.py:10: [C0411(wrong-import-order), ] standard import "from functools import wraps" comes before "from spyne.model.fault import Fault"
************* Module elbepack.daemons.soap.authentication
elbepack/daemons/soap/authentication.py:8: [C0411(wrong-import-order), ] standard import "from functools import wraps" comes before "from faults import SoapElbeNotLoggedIn, SoapElbeNotAuthorized"
************* Module elbepack.debianize.barebox
elbepack/debianize/barebox.py:11: [C0411(wrong-import-order), ] standard import "from shutil import copyfile" comes before "from npyscreen import TitleText"
************* Module elbepack.debianize.base
elbepack/debianize/base.py:16: [C0411(wrong-import-order), ] standard import "from shutil import copyfile" comes before "from npyscreen import FormMultiPage"
************* Module elbepack.debianize.kernel
elbepack/debianize/kernel.py:12: [C0411(wrong-import-order), ] standard import "from shutil import copyfile" comes before "from npyscreen import TitleText, TitleSelectOne"
--------------------------------------------------------------------------------------------------------------------------------------------

fix them all by ordering standard lib imports
before other imports
elbepack imports last.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/commands/add.py                |  2 +-
 elbepack/commands/check_updates.py      |  4 ++--
 elbepack/commands/chg_archive.py        |  3 ++-
 elbepack/commands/control.py            |  4 ++--
 elbepack/commands/get_archive.py        |  2 +-
 elbepack/commands/init.py               |  4 ++--
 elbepack/commands/pin_versions.py       |  3 ++-
 elbepack/commands/prjrepo.py            |  3 ++-
 elbepack/commands/setsel.py             |  3 ++-
 elbepack/commands/show.py               |  3 ++-
 elbepack/commands/xsdtoasciidoc.py      |  3 ++-
 elbepack/daemons/soap/authentication.py |  3 ++-
 elbepack/daemons/soap/faults.py         |  4 ++--
 elbepack/debianize/barebox.py           |  4 ++--
 elbepack/debianize/base.py              |  3 +--
 elbepack/debianize/kernel.py            |  4 ++--
 elbepack/dump.py                        | 10 +++++-----
 elbepack/elbexml.py                     | 14 +++++++-------
 elbepack/finetuning.py                  |  3 ++-
 elbepack/rpcaptcache.py                 | 15 ++++++++-------
 elbepack/soapclient.py                  |  5 +++--
 elbepack/updated.py                     |  6 ++++--
 elbepack/version.py                     |  3 ++-
 23 files changed, 60 insertions(+), 48 deletions(-)

diff --git a/elbepack/commands/add.py b/elbepack/commands/add.py
index a038b78c..8f666a5f 100644
--- a/elbepack/commands/add.py
+++ b/elbepack/commands/add.py
@@ -7,9 +7,9 @@ from __future__ import print_function
 
 import sys
 
-from elbepack.elbexml import ElbeXML
 from optparse import OptionParser
 
+from elbepack.elbexml import ElbeXML
 
 def run_command(argv):
 
diff --git a/elbepack/commands/check_updates.py b/elbepack/commands/check_updates.py
index 153ea9a0..f2b9cb74 100644
--- a/elbepack/commands/check_updates.py
+++ b/elbepack/commands/check_updates.py
@@ -10,10 +10,10 @@ from __future__ import print_function
 import os
 import sys
 
+from optparse import OptionParser
+
 from elbepack.treeutils import etree
 from elbepack import virtapt
-
-from optparse import OptionParser
 from elbepack.validate import validate_xml
 from elbepack.xmldefaults import ElbeDefaults
 
diff --git a/elbepack/commands/chg_archive.py b/elbepack/commands/chg_archive.py
index dc4dcdd5..c96648a3 100644
--- a/elbepack/commands/chg_archive.py
+++ b/elbepack/commands/chg_archive.py
@@ -8,9 +8,10 @@ from __future__ import print_function
 import sys
 import os
 
+from optparse import OptionParser
+
 from elbepack.archivedir import chg_archive
 from elbepack.treeutils import etree
-from optparse import OptionParser
 
 def run_command(argv):
 
diff --git a/elbepack/commands/control.py b/elbepack/commands/control.py
index b1d48eb8..16ee5c96 100644
--- a/elbepack/commands/control.py
+++ b/elbepack/commands/control.py
@@ -11,14 +11,14 @@ import socket
 import sys
 
 from optparse import (OptionParser, OptionGroup)
-from suds import WebFault
 from urllib2 import URLError
 from httplib import BadStatusLine
 
+from suds import WebFault
+
 from elbepack.soapclient import ClientAction, ElbeSoapClient
 from elbepack.version import elbe_version
 from elbepack.config import cfg
-
 from elbepack.elbexml import ValidationMode
 
 
diff --git a/elbepack/commands/get_archive.py b/elbepack/commands/get_archive.py
index 7838b940..2dd4ecc9 100644
--- a/elbepack/commands/get_archive.py
+++ b/elbepack/commands/get_archive.py
@@ -10,9 +10,9 @@ import os
 import sys
 
 from base64 import standard_b64decode
+from optparse import OptionParser
 
 from elbepack.treeutils import etree
-from optparse import OptionParser
 
 
 def unbase(s, fname):
diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 2bd52a65..7e9ee61d 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -11,6 +11,8 @@ import os
 import sys
 import shutil
 
+from optparse import OptionParser
+
 from elbepack.treeutils import etree
 from elbepack.validate import validate_xml
 from elbepack.pkgutils import copy_kinitrd, NoKinitrdException
@@ -20,8 +22,6 @@ from elbepack.templates import write_template, get_initvm_preseed
 from elbepack.directories import init_template_dir, elbe_dir
 from elbepack.config import cfg
 
-from optparse import OptionParser
-
 
 def run_command(argv):
 
diff --git a/elbepack/commands/pin_versions.py b/elbepack/commands/pin_versions.py
index cfbd68e4..3444f2c7 100644
--- a/elbepack/commands/pin_versions.py
+++ b/elbepack/commands/pin_versions.py
@@ -8,8 +8,9 @@ from __future__ import print_function
 
 import sys
 
-from elbepack.treeutils import etree
 from optparse import OptionParser
+
+from elbepack.treeutils import etree
 from elbepack.validate import validate_xml
 
 
diff --git a/elbepack/commands/prjrepo.py b/elbepack/commands/prjrepo.py
index 9c18b084..aaca99ab 100644
--- a/elbepack/commands/prjrepo.py
+++ b/elbepack/commands/prjrepo.py
@@ -11,10 +11,11 @@ import socket
 import sys
 
 from optparse import (OptionParser, OptionGroup)
-from suds import WebFault
 from urllib2 import URLError
 from httplib import BadStatusLine
 
+from suds import WebFault
+
 from elbepack.soapclient import RepoAction, ElbeSoapClient
 from elbepack.version import elbe_version
 from elbepack.config import cfg
diff --git a/elbepack/commands/setsel.py b/elbepack/commands/setsel.py
index f33bfc01..13acb30b 100644
--- a/elbepack/commands/setsel.py
+++ b/elbepack/commands/setsel.py
@@ -8,9 +8,10 @@ from __future__ import print_function
 
 import sys
 
-from elbepack.treeutils import etree
 from optparse import OptionParser
 
+from elbepack.treeutils import etree
+
 
 def parse_selections(fname):
     fp = file(fname, "r")
diff --git a/elbepack/commands/show.py b/elbepack/commands/show.py
index 6627fd5c..dfa9da2c 100644
--- a/elbepack/commands/show.py
+++ b/elbepack/commands/show.py
@@ -8,10 +8,11 @@ from __future__ import print_function
 
 import sys
 
+from optparse import OptionParser
+
 from elbepack.treeutils import etree
 from elbepack.validate import validate_xml
 
-from optparse import OptionParser
 
 
 def run_command(argv):
diff --git a/elbepack/commands/xsdtoasciidoc.py b/elbepack/commands/xsdtoasciidoc.py
index 547fa3d5..75b69021 100644
--- a/elbepack/commands/xsdtoasciidoc.py
+++ b/elbepack/commands/xsdtoasciidoc.py
@@ -8,11 +8,12 @@ from __future__ import print_function
 
 import sys
 
+from optparse import OptionParser
+
 from elbepack.treeutils import etree
 from elbepack.directories import xsdtoasciidoc_mako_fname
 from elbepack.templates import write_template
 
-from optparse import OptionParser
 
 
 def run_command(argv):
diff --git a/elbepack/daemons/soap/authentication.py b/elbepack/daemons/soap/authentication.py
index cc2e05e8..5e42fb3d 100644
--- a/elbepack/daemons/soap/authentication.py
+++ b/elbepack/daemons/soap/authentication.py
@@ -4,9 +4,10 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from faults import SoapElbeNotLoggedIn, SoapElbeNotAuthorized
 from functools import wraps
 
+from faults import SoapElbeNotLoggedIn, SoapElbeNotAuthorized
+
 
 def authenticated_uid(func):
     """ decorator, which Checks, that the current session is logged in,
diff --git a/elbepack/daemons/soap/faults.py b/elbepack/daemons/soap/faults.py
index f2409d92..8e9f966c 100644
--- a/elbepack/daemons/soap/faults.py
+++ b/elbepack/daemons/soap/faults.py
@@ -4,11 +4,11 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from spyne.model.fault import Fault
 from traceback import format_exc
-
 from functools import wraps
 
+from spyne.model.fault import Fault
+
 # Import the Errors we try to catch wirh the
 # soap_faults decorator
 from elbepack.projectmanager import ProjectManagerError, InvalidState
diff --git a/elbepack/debianize/barebox.py b/elbepack/debianize/barebox.py
index 766c2dc9..e2a0118b 100644
--- a/elbepack/debianize/barebox.py
+++ b/elbepack/debianize/barebox.py
@@ -6,10 +6,10 @@
 
 import os
 
-from npyscreen import TitleText
-
 from shutil import copyfile
 
+from npyscreen import TitleText
+
 from elbepack.directories import mako_template_dir
 from elbepack.debianize.base import DebianizeBase, template
 
diff --git a/elbepack/debianize/base.py b/elbepack/debianize/base.py
index 470c8b16..3e0f7cfe 100644
--- a/elbepack/debianize/base.py
+++ b/elbepack/debianize/base.py
@@ -9,12 +9,11 @@ import os
 import sys
 
 from time import sleep
+from shutil import copyfile
 
 from npyscreen import FormMultiPage
 from npyscreen import TitleText, TitleSelectOne, ButtonPress, notify
 
-from shutil import copyfile
-
 from elbepack.templates import template
 
 
diff --git a/elbepack/debianize/kernel.py b/elbepack/debianize/kernel.py
index 5a6d0d4e..b84cf710 100644
--- a/elbepack/debianize/kernel.py
+++ b/elbepack/debianize/kernel.py
@@ -7,10 +7,10 @@
 
 import os
 
-from npyscreen import TitleText, TitleSelectOne
-
 from shutil import copyfile
 
+from npyscreen import TitleText, TitleSelectOne
+
 from elbepack.directories import mako_template_dir
 from elbepack.debianize.base import DebianizeBase, template
 
diff --git a/elbepack/dump.py b/elbepack/dump.py
index 11513328..e8d30f45 100644
--- a/elbepack/dump.py
+++ b/elbepack/dump.py
@@ -5,16 +5,16 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from elbepack.asciidoclog import ASCIIDocLog
+import warnings
 from datetime import datetime
+
+from apt import Cache
+
+from elbepack.asciidoclog import ASCIIDocLog
 from elbepack.finetuning import do_finetuning
 from elbepack.filesystem import hostfs
 from elbepack.version import elbe_version
-
 from elbepack.aptpkgutils import APTPackage
-from apt import Cache
-
-import warnings
 
 
 def get_initvm_pkglist():
diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 27feb15d..c60b7d8a 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -8,19 +8,19 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
+import os
+import re
+import urllib2
+
+from base64 import standard_b64decode
+from tempfile import NamedTemporaryFile
+
 from elbepack.treeutils import etree
 from elbepack.validate import validate_xml
 from elbepack.xmldefaults import ElbeDefaults
 
 from elbepack.version import elbe_version, is_devel
 
-from base64 import standard_b64decode
-from tempfile import NamedTemporaryFile
-
-import urllib2
-import os
-import re
-
 
 class ValidationError(Exception):
     def __init__(self, validation):
diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index c9071ab4..3838ab1d 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -11,10 +11,11 @@ from __future__ import print_function
 import os
 import gpgme
 
-from apt.package import FetchError
 from shutil import rmtree
 from io import BytesIO
 
+from apt.package import FetchError
+
 from elbepack.repomanager import UpdateRepo
 from elbepack.rpcaptcache import get_rpcaptcache
 from elbepack.shellhelper import CommandError
diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
index 74cad511..6401b63e 100644
--- a/elbepack/rpcaptcache.py
+++ b/elbepack/rpcaptcache.py
@@ -6,20 +6,21 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
+import os
+import sys
+import time
+import warnings
+
 from multiprocessing.util import Finalize
+from multiprocessing.managers import BaseManager
+
 from apt_pkg import config, version_compare
 from apt import Cache
-from multiprocessing.managers import BaseManager
+
 from elbepack.aptprogress import (ElbeAcquireProgress, ElbeInstallProgress,
                                   ElbeOpProgress)
 from elbepack.aptpkgutils import getalldeps, APTPackage
 
-import os
-import sys
-import time
-import warnings
-
-
 class InChRootObject(object):
     def __init__(self, rfs):
         self.rfs = rfs
diff --git a/elbepack/soapclient.py b/elbepack/soapclient.py
index b8fbc431..c753ce3b 100644
--- a/elbepack/soapclient.py
+++ b/elbepack/soapclient.py
@@ -16,12 +16,13 @@ import os
 import fnmatch
 import deb822   # package for dealing with Debian related data
 
-from suds.client import Client
-from suds import WebFault
 from datetime import datetime
 from urllib2 import URLError
 from httplib import BadStatusLine
 
+from suds.client import Client
+from suds import WebFault
+
 from elbepack.filesystem import Filesystem
 from elbepack.elbexml import ElbeXML, ValidationMode
 
diff --git a/elbepack/updated.py b/elbepack/updated.py
index 2ef8408e..48804dff 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -19,14 +19,16 @@ import sys
 import threading
 
 from multiprocessing import Process
+from zipfile import (ZipFile, BadZipfile)
 from shutil import copyfile, rmtree, copy
+
+from syslog import syslog
+
 from spyne import Application
 from spyne.service import ServiceBase
 from spyne.decorator import rpc
 from spyne.model.primitive import String
 from suds.client import Client
-from syslog import syslog
-from zipfile import (ZipFile, BadZipfile)
 
 from elbepack.aptprogress import (ElbeInstallProgress,
                                   ElbeAcquireProgress, ElbeOpProgress)
diff --git a/elbepack/version.py b/elbepack/version.py
index 3b3e7f73..28538557 100644
--- a/elbepack/version.py
+++ b/elbepack/version.py
@@ -4,9 +4,10 @@
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-from elbepack.directories import pack_dir
 from platform import linux_distribution
 
+from elbepack.directories import pack_dir
+
 elbe_version = "2.9.12"
 running_os = linux_distribution()
 
-- 
2.11.0




More information about the elbe-devel mailing list