fix ungrouped imports from package X
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Sep 2017 17:20:31 +0300
changeset 1834 cd42b426028b
parent 1833 2269739dd098
child 1835 7533061a6d82
fix ungrouped imports from package X
BeremizIDE.py
Beremiz_service.py
PLCOpenEditor.py
ProjectController.py
canfestival/canfestival.py
canfestival/config_utils.py
controls/VariablePanel.py
dialogs/ActionBlockDialog.py
editors/CodeFileEditor.py
editors/ResourceEditor.py
editors/Viewer.py
runtime/WampClient.py
svgui/pyjs/build.py
tests/tools/check_source.sh
--- a/BeremizIDE.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/BeremizIDE.py	Thu Sep 28 17:20:31 2017 +0300
@@ -30,9 +30,9 @@
 import shutil
 import random
 import re
-import time
 import types
 import commands
+import time
 from time import time as gettime
 from threading import Lock, Timer, currentThread
 
@@ -43,15 +43,16 @@
 
 
 import version
-import util.paths as paths
 from docutil import OpenHtmlFrame
 from editors.EditorPanel import EditorPanel
 from editors.Viewer import Viewer
 from editors.TextViewer import TextViewer
 from editors.ResourceEditor import ConfigurationEditor, ResourceEditor
 from editors.DataTypeEditor import DataTypeEditor
+from util import paths as paths
 from util.MiniTextControler import MiniTextControler
 from util.ProcessLogger import ProcessLogger
+from util.BitmapLibrary import GetBitmap
 from controls.LogViewer import LogViewer
 from controls.CustomStyledTextCtrl import CustomStyledTextCtrl
 from controls import EnhancedStatusBar as esb
@@ -85,8 +86,6 @@
     EncodeFileSystemPath, \
     DecodeFileSystemPath
 
-from util.BitmapLibrary import GetBitmap
-
 
 beremiz_dir = paths.AbsDir(__file__)
 
--- a/Beremiz_service.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/Beremiz_service.py	Thu Sep 28 17:20:31 2017 +0300
@@ -29,7 +29,7 @@
 import sys
 import getopt
 import threading
-from threading import Thread, currentThread
+from threading import Thread, currentThread, Semaphore
 import traceback
 import __builtin__
 import Pyro.core as pyro
@@ -496,7 +496,6 @@
         reactor.registerWxApp(app)
 
 if havewx:
-    from threading import Semaphore
     wx_eval_lock = Semaphore(0)
     main_thread = currentThread()
 
@@ -568,7 +567,7 @@
 if havetwisted:
     if webport is not None:
         try:
-            import runtime.NevowServer as NS
+            import runtime.NevowServer as NS  # pylint: disable=C0412
         except Exception, e:
             print(_("Nevow/Athena import failed :"), e)
             webport = None
@@ -576,7 +575,7 @@
 
     if wampconf is not None:
         try:
-            import runtime.WampClient as WC
+            import runtime.WampClient as WC  # pylint: disable=C0412
         except Exception, e:
             print(_("WAMP import failed :"), e)
             wampconf = None
--- a/PLCOpenEditor.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/PLCOpenEditor.py	Thu Sep 28 17:20:31 2017 +0300
@@ -34,6 +34,7 @@
 import version
 import util.paths as paths
 import util.ExceptionHandler
+from util.misc import InstallLocalRessources
 from IDEFrame import IDEFrame, AppendMenu
 from IDEFrame import \
     TITLE, \
@@ -50,7 +51,6 @@
 from PLCControler import PLCControler
 from dialogs import ProjectDialog
 from dialogs.AboutDialog import ShowAboutDialog
-from util.misc import InstallLocalRessources
 
 
 # -------------------------------------------------------------------------------
--- a/ProjectController.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/ProjectController.py	Thu Sep 28 17:20:31 2017 +0300
@@ -30,13 +30,13 @@
 import sys
 import traceback
 import time
+from time import localtime
 import shutil
 import re
 import tempfile
 from math import ceil
 from types import ListType
 from threading import Timer, Lock, Thread
-from time import localtime
 from datetime import datetime
 from weakref import WeakKeyDictionary
 from itertools import izip
@@ -44,7 +44,6 @@
 import wx
 
 import features
-import targets
 import connectors
 import util.paths as paths
 from util.misc import CheckPathPerm, GetClassImporter
@@ -58,8 +57,9 @@
 from dialogs import DiscoveryDialog
 from PLCControler import PLCControler
 from plcopen.structures import IEC_KEYWORDS
-from targets.typemapping import DebugTypesSize, LogLevelsCount, LogLevels
-from targets.typemapping import UnpackDebugBuffer
+import targets
+from targets.typemapping import DebugTypesSize, \
+    LogLevelsCount, LogLevels, UnpackDebugBuffer
 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
 
 base_folder = paths.AbsParentDir(__file__)
--- a/canfestival/canfestival.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/canfestival/canfestival.py	Thu Sep 28 17:20:31 2017 +0300
@@ -50,15 +50,14 @@
 
     from nodelist import NodeList
 
-
 from nodemanager import NodeManager
-import config_utils
 import gen_cfile
 import eds_utils
 import canfestival_config as local_canfestival_config
 
 from commondialogs import CreateNodeDialog
 from subindextable import IECTypeConversion, SizeConversion
+import config_utils
 from SlaveEditor import SlaveEditor, MasterViewer
 from NetworkEditor import NetworkEditor
 
--- a/canfestival/config_utils.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/canfestival/config_utils.py	Thu Sep 28 17:20:31 2017 +0300
@@ -24,6 +24,9 @@
 
 
 from __future__ import print_function
+import os
+import sys
+import getopt
 from types import *
 
 # Translation between IEC types and Can Open types
@@ -694,10 +697,6 @@
 
 
 if __name__ == "__main__":
-    import os
-    import sys
-    import getopt
-
     def usage():
         print("""
 Usage of config_utils.py test :
@@ -784,8 +783,6 @@
 
         print("Reset Successful!")
     else:
-        import os
-
         testfile = open("test_config/result_tmp.txt", "w")
         testfile.write(result)
         testfile.close()
--- a/controls/VariablePanel.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/controls/VariablePanel.py	Thu Sep 28 17:20:31 2017 +0300
@@ -37,8 +37,8 @@
 from CustomTable import CustomTable
 from LocationCellEditor import LocationCellEditor
 from util.BitmapLibrary import GetBitmap
+from util.TranslationCatalogs import NoTranslate
 from PLCControler import _VariableInfos
-from util.TranslationCatalogs import NoTranslate
 
 
 # -------------------------------------------------------------------------------
--- a/dialogs/ActionBlockDialog.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/dialogs/ActionBlockDialog.py	Thu Sep 28 17:20:31 2017 +0300
@@ -27,8 +27,8 @@
 import wx.lib.buttons
 
 from controls import CustomGrid, CustomTable
+from PLCControler import _ActionInfos
 from util.BitmapLibrary import GetBitmap
-from PLCControler import _ActionInfos
 from util.TranslationCatalogs import NoTranslate
 # -------------------------------------------------------------------------------
 #                                  Helpers
--- a/editors/CodeFileEditor.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/editors/CodeFileEditor.py	Thu Sep 28 17:20:31 2017 +0300
@@ -32,12 +32,13 @@
 from plcopen.plcopen import TestTextElement
 from plcopen.structures import TestIdentifier, IEC_KEYWORDS, DefaultType
 from controls import CustomGrid, CustomTable
+from controls.CustomStyledTextCtrl import CustomStyledTextCtrl, faces, GetCursorPos, NAVIGATION_KEYS
+from controls.VariablePanel import VARIABLE_NAME_SUFFIX_MODEL
 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
 from util.BitmapLibrary import GetBitmap
-from controls.CustomStyledTextCtrl import CustomStyledTextCtrl, faces, GetCursorPos, NAVIGATION_KEYS
-from controls.VariablePanel import VARIABLE_NAME_SUFFIX_MODEL
+from util.TranslationCatalogs import NoTranslate
 from graphics.GraphicCommons import ERROR_HIGHLIGHT, SEARCH_RESULT_HIGHLIGHT, REFRESH_HIGHLIGHT_PERIOD
-from util.TranslationCatalogs import NoTranslate
+
 
 [STC_CODE_ERROR, STC_CODE_SEARCH_RESULT,
  STC_CODE_SECTION] = range(15, 18)
--- a/editors/ResourceEditor.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/editors/ResourceEditor.py	Thu Sep 28 17:20:31 2017 +0300
@@ -31,8 +31,8 @@
 from dialogs.DurationEditorDialog import IEC_TIME_MODEL
 from EditorPanel import EditorPanel
 from util.BitmapLibrary import GetBitmap
+from util.TranslationCatalogs import NoTranslate
 from plcopen.structures import LOCATIONDATATYPES, TestIdentifier, IEC_KEYWORDS, DefaultType
-from util.TranslationCatalogs import NoTranslate
 
 
 # -------------------------------------------------------------------------------
--- a/editors/Viewer.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/editors/Viewer.py	Thu Sep 28 17:20:31 2017 +0300
@@ -33,9 +33,8 @@
 from plcopen.structures import *
 from PLCControler import ITEM_VAR_LOCAL, ITEM_POU, ITEM_PROGRAM, ITEM_FUNCTIONBLOCK
 from graphics.DebugDataConsumer import DebugDataConsumer
-
+from graphics import *
 from dialogs import *
-from graphics import *
 from editors.DebugViewer import DebugViewer, REFRESH_PERIOD
 from EditorPanel import EditorPanel
 
--- a/runtime/WampClient.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/runtime/WampClient.py	Thu Sep 28 17:20:31 2017 +0300
@@ -28,9 +28,9 @@
 
 from autobahn.twisted import wamp
 from autobahn.twisted.websocket import WampWebSocketClientFactory, connectWS
-from twisted.internet.defer import inlineCallbacks
 from autobahn.wamp import types
 from autobahn.wamp.serializer import MsgPackSerializer
+from twisted.internet.defer import inlineCallbacks
 from twisted.internet.protocol import ReconnectingClientFactory
 
 
--- a/svgui/pyjs/build.py	Thu Sep 28 16:25:05 2017 +0300
+++ b/svgui/pyjs/build.py	Thu Sep 28 17:20:31 2017 +0300
@@ -2,13 +2,13 @@
 
 from __future__ import print_function
 import sys
-import os
 import shutil
 import time
 import re
+import os
+from os.path import join, dirname, basename, abspath, split, isfile, isdir
 from hashlib import md5
 from copy import copy
-from os.path import join, dirname, basename, abspath, split, isfile, isdir
 from optparse import OptionParser
 from cStringIO import StringIO
 
--- a/tests/tools/check_source.sh	Thu Sep 28 16:25:05 2017 +0300
+++ b/tests/tools/check_source.sh	Thu Sep 28 17:20:31 2017 +0300
@@ -205,8 +205,9 @@
     enable=$enable,E1601          # print statement used
     enable=$enable,C0325          # (superfluous-parens) Unnecessary parens after keyword    
     enable=$enable,W0404          # reimported module    
-    enable=$enable,C0411          # (wrong-import-order), standard import "import x" comes before "import y"
-    enable=$enable,W0108          # (unnecessary-lambda), Lambda may not be necessary
+    enable=$enable,C0411          # (wrong-import-order) standard import "import x" comes before "import y"
+    enable=$enable,W0108          # (unnecessary-lambda) Lambda may not be necessary
+    enable=$enable,C0412          # (ungrouped-imports) Imports from package X are not grouped
 
     # enable=$enable,W0403        # relative import
     # enable=$enable,W0622        # (redefined-builtin) Redefining built-in