fix wrong-import-order. first standard modules are imported, then others
--- a/BeremizIDE.py Thu Sep 28 12:20:40 2017 +0300
+++ b/BeremizIDE.py Thu Sep 28 15:17:57 2017 +0300
@@ -29,21 +29,20 @@
+from time import time as gettime +from threading import Lock, Timer, currentThread -from types import ListType
-from threading import Lock, Timer, currentThread
-from time import time as gettime
import util.paths as paths
from docutil import OpenHtmlFrame
from editors.EditorPanel import EditorPanel
@@ -723,7 +722,7 @@
def GenerateMenuRecursive(self, items, menu):
for kind, infos in items:
- if isinstance(kind, ListType):
+ if isinstance(kind, types.ListType): self.GenerateMenuRecursive(kind, submenu)
--- a/PLCControler.py Thu Sep 28 12:20:40 2017 +0300
+++ b/PLCControler.py Thu Sep 28 15:17:57 2017 +0300
@@ -25,15 +25,17 @@
from xml.dom import minidom
from types import StringType, UnicodeType, TupleType
from copy import deepcopy
-import util.paths as paths
from time import localtime
from collections import OrderedDict, namedtuple
+import util.paths as paths from util.TranslationCatalogs import NoTranslate
from graphics.GraphicCommons import *
--- a/PLCGenerator.py Thu Sep 28 12:20:40 2017 +0300
+++ b/PLCGenerator.py Thu Sep 28 15:17:57 2017 +0300
@@ -22,10 +22,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from plcopen import PLCOpenParser
from plcopen.structures import *
# Dictionary associating PLCOpen variable categories to the corresponding
# IEC 61131-3 variable categories
--- a/PLCOpenEditor.py Thu Sep 28 12:20:40 2017 +0300
+++ b/PLCOpenEditor.py Thu Sep 28 15:17:57 2017 +0300
@@ -25,15 +25,15 @@
from __future__ import print_function
import util.paths as paths
import util.ExceptionHandler
from IDEFrame import IDEFrame, AppendMenu
--- a/ProjectController.py Thu Sep 28 12:20:40 2017 +0300
+++ b/ProjectController.py Thu Sep 28 15:17:57 2017 +0300
@@ -30,9 +30,7 @@
@@ -43,6 +41,9 @@
from weakref import WeakKeyDictionary
from itertools import izip
import util.paths as paths
--- a/connectors/PYRO/__init__.py Thu Sep 28 12:20:40 2017 +0300
+++ b/connectors/PYRO/__init__.py Thu Sep 28 15:17:57 2017 +0300
@@ -24,16 +24,18 @@
from __future__ import print_function
-from Pyro.errors import PyroError
+from Pyro.errors import PyroError service_type = '_PYRO._tcp.local.'
# this module attribute contains a list of DNS-SD (Zeroconf) service types
# supported by this connector confnode.
--- a/connectors/WAMP/__init__.py Thu Sep 28 12:20:40 2017 +0300
+++ b/connectors/WAMP/__init__.py Thu Sep 28 15:17:57 2017 +0300
@@ -27,13 +27,15 @@
+from threading import Thread, Event from twisted.internet import reactor, threads
from autobahn.twisted import wamp
from autobahn.twisted.websocket import WampWebSocketClientFactory, connectWS
from autobahn.wamp import types
from autobahn.wamp.exception import TransportLost
from autobahn.wamp.serializer import MsgPackSerializer
-from threading import Thread, Event
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Sep 28 12:20:40 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Sep 28 15:17:57 2017 +0300
@@ -24,10 +24,10 @@
from types import TupleType
from time import time as gettime
+from distutils.version import LooseVersion
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
@@ -36,13 +36,11 @@
from mpl_toolkits.mplot3d import Axes3D
from editors.DebugViewer import REFRESH_PERIOD
from DebugVariableItem import DebugVariableItem
from DebugVariableViewer import *
from GraphButton import GraphButton
-from distutils.version import LooseVersion
if LooseVersion(matplotlib.__version__) >= LooseVersion("1.5.0"):
from cycler import cycler
--- a/controls/DebugVariablePanel/DebugVariableItem.py Thu Sep 28 12:20:40 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableItem.py Thu Sep 28 15:17:57 2017 +0300
@@ -22,9 +22,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from graphics.DebugDataConsumer import DebugDataConsumer, TYPE_TRANSLATOR
# -------------------------------------------------------------------------------
--- a/controls/LogViewer.py Thu Sep 28 12:20:40 2017 +0300
+++ b/controls/LogViewer.py Thu Sep 28 15:17:57 2017 +0300
@@ -25,15 +25,16 @@
from datetime import datetime
from time import time as gettime
+from weakref import proxy
from controls.CustomToolTip import CustomToolTip, TOOLTIP_WAIT_PERIOD
from editors.DebugViewer import DebugViewer, REFRESH_PERIOD
from targets.typemapping import LogLevelsCount, LogLevels
from util.BitmapLibrary import GetBitmap
-from weakref import proxy
THUMB_SIZE_RATIO = 1. / 8.
--- a/controls/TextCtrlAutoComplete.py Thu Sep 28 12:20:40 2017 +0300
+++ b/controls/TextCtrlAutoComplete.py Thu Sep 28 15:17:57 2017 +0300
@@ -22,8 +22,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--- a/docutil/docsvg.py Thu Sep 28 12:20:40 2017 +0300
+++ b/docutil/docsvg.py Thu Sep 28 15:17:57 2017 +0300
@@ -22,9 +22,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--- a/editors/LDViewer.py Thu Sep 28 12:20:40 2017 +0300
+++ b/editors/LDViewer.py Thu Sep 28 15:17:57 2017 +0300
@@ -22,10 +22,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--- a/graphics/GraphicCommons.py Thu Sep 28 12:20:40 2017 +0300
+++ b/graphics/GraphicCommons.py Thu Sep 28 15:17:57 2017 +0300
@@ -22,12 +22,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from threading import Lock, Timer
from graphics.ToolTipProducer import ToolTipProducer
from graphics.DebugDataConsumer import DebugDataConsumer
--- a/i18n/mki18n.py Thu Sep 28 12:20:40 2017 +0300
+++ b/i18n/mki18n.py Thu Sep 28 15:17:57 2017 +0300
@@ -81,8 +81,8 @@
from __future__ import print_function
# -----------------------------------------------------------------------------
--- a/plcopen/plcopen.py Thu Sep 28 12:20:40 2017 +0300
+++ b/plcopen/plcopen.py Thu Sep 28 15:17:57 2017 +0300
@@ -23,12 +23,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+from collections import OrderedDict -from collections import OrderedDict
import util.paths as paths
--- a/plcopen/structures.py Thu Sep 28 12:20:40 2017 +0300
+++ b/plcopen/structures.py Thu Sep 28 15:17:57 2017 +0300
@@ -24,8 +24,9 @@
+from collections import OrderedDict from plcopen import LoadProject
-from collections import OrderedDict
from definitions import *
TypeHierarchy = dict(TypeHierarchy_list)
--- a/runtime/PLCObject.py Thu Sep 28 12:20:40 2017 +0300
+++ b/runtime/PLCObject.py Thu Sep 28 15:17:57 2017 +0300
@@ -21,7 +21,7 @@
# 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 Pyro.core as pyro
from threading import Timer, Thread, Lock, Semaphore, Event
@@ -29,8 +29,11 @@
+import Pyro.core as pyro from targets.typemapping import LogLevelsDefault, LogLevelsCount, TypeTranslator, UnpackDebugBuffer
if os.name in ("nt", "ce"):
--- a/runtime/WampClient.py Thu Sep 28 12:20:40 2017 +0300
+++ b/runtime/WampClient.py Thu Sep 28 15:17:57 2017 +0300
@@ -24,13 +24,15 @@
from __future__ import print_function
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.protocol import ReconnectingClientFactory
--- a/svgui/pyjs/build.py Thu Sep 28 12:20:40 2017 +0300
+++ b/svgui/pyjs/build.py Thu Sep 28 15:17:57 2017 +0300
@@ -4,18 +4,16 @@
from os.path import join, dirname, basename, abspath, split, isfile, isdir
from optparse import OptionParser
+from cStringIO import StringIO
-from cStringIO import StringIO
- from hashlib import md5
usage: %prog [options] <application module name or path>
--- a/svgui/pyjs/jsonrpc/jsonrpc.py Thu Sep 28 12:20:40 2017 +0300
+++ b/svgui/pyjs/jsonrpc/jsonrpc.py Thu Sep 28 15:17:57 2017 +0300
@@ -1,6 +1,6 @@
-import gluon.contrib.simplejson as simplejson
+import gluon.contrib.simplejson as simplejson class JSONRPCServiceBase:
--- a/svgui/pyjs/lib/pyjslib.py Thu Sep 28 12:20:40 2017 +0300
+++ b/svgui/pyjs/lib/pyjslib.py Thu Sep 28 15:17:57 2017 +0300
@@ -233,7 +233,7 @@
# as comment on line 20 says
# import sys should be below
+import sys # noqa # pylint: disable=C0411 --- a/svgui/svgui.py Thu Sep 28 12:20:40 2017 +0300
+++ b/svgui/svgui.py Thu Sep 28 15:17:57 2017 +0300
@@ -23,11 +23,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from pyjs import translate
import util.paths as paths
--- a/targets/toolchain_gcc.py Thu Sep 28 12:20:40 2017 +0300
+++ b/targets/toolchain_gcc.py Thu Sep 28 15:17:57 2017 +0300
@@ -26,8 +26,10 @@
from util.ProcessLogger import ProcessLogger
includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
--- a/targets/toolchain_makefile.py Thu Sep 28 12:20:40 2017 +0300
+++ b/targets/toolchain_makefile.py Thu Sep 28 15:17:57 2017 +0300
@@ -25,10 +25,11 @@
from util.ProcessLogger import ProcessLogger
includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
--- a/tests/tools/check_source.sh Thu Sep 28 12:20:40 2017 +0300
+++ b/tests/tools/check_source.sh Thu Sep 28 15:17:57 2017 +0300
@@ -204,12 +204,12 @@
enable=$enable,E1601 # print statement used
enable=$enable,C0325 # (superfluous-parens) Unnecessary parens after keyword
enable=$enable,W0404 # reimported module
- # enable=$enable,C1001 # (old-style-class) Old-style class defined. Problem with PyJS
+ enable=$enable,C0411 # (wrong-import-order), ] standard import "import x" comes before "import y" # enable=$enable,W0403 # relative import
# enable=$enable,W0622 # (redefined-builtin) Redefining built-in
# enable=$enable,W0612 # unused-variable
+ # enable=$enable,C1001 # (old-style-class) Old-style class defined. Problem with PyJS --- a/tests/tools/conftest.py Thu Sep 28 12:20:40 2017 +0300
+++ b/tests/tools/conftest.py Thu Sep 28 15:17:57 2017 +0300
@@ -24,9 +24,10 @@
# append module root directory to sys.path
--- a/tests/tools/test_CustomIntCtrl.py Thu Sep 28 12:20:40 2017 +0300
+++ b/tests/tools/test_CustomIntCtrl.py Thu Sep 28 15:17:57 2017 +0300
@@ -23,8 +23,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import controls.CustomIntCtrl
--- a/tests/tools/test_application.py Thu Sep 28 12:20:40 2017 +0300
+++ b/tests/tools/test_application.py Thu Sep 28 15:17:57 2017 +0300
@@ -27,10 +27,11 @@
--- a/util/ProcessLogger.py Thu Sep 28 12:20:40 2017 +0300
+++ b/util/ProcessLogger.py Thu Sep 28 15:17:57 2017 +0300
@@ -25,10 +25,10 @@
from threading import Timer, Lock, Thread, Semaphore
from signal import SIGTERM, SIGKILL
--- a/wxglade_hmi/wxglade_hmi.py Thu Sep 28 12:20:40 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py Thu Sep 28 15:17:57 2017 +0300
@@ -23,12 +23,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from xml.dom import minidom
import util.paths as paths
from py_ext import PythonFileCTNMixin
--- a/xmlclass/xmlclass.py Thu Sep 28 12:20:40 2017 +0300
+++ b/xmlclass/xmlclass.py Thu Sep 28 15:17:57 2017 +0300
@@ -31,10 +31,11 @@
from xml.dom import minidom
from xml.sax.saxutils import escape, unescape, quoteattr
from collections import OrderedDict