# HG changeset patch # User Andrey Skvortsov # Date 1506601077 -10800 # Node ID 0f1081928d652c253ea18abc3d8d263cb3acb69f # Parent 56b48961cc685ed0674d3143824e94a4f450328a fix wrong-import-order. first standard modules are imported, then others diff -r 56b48961cc68 -r 0f1081928d65 BeremizIDE.py --- 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 @@ import tempfile import shutil import random +import re import time -import version - -from types import ListType - +import types +import commands +from time import time as gettime +from threading import Lock, Timer, currentThread + +import cPickle import wx.lib.buttons import wx.lib.statbmp import wx.stc -import cPickle -import types -import re -import commands -from threading import Lock, Timer, currentThread -from time import time as gettime - + + +import version 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): text, id = infos submenu = wx.Menu('') self.GenerateMenuRecursive(kind, submenu) diff -r 56b48961cc68 -r 0f1081928d65 PLCControler.py --- 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 lxml import etree from copy import deepcopy import os import sys import re import datetime -import util.paths as paths from time import localtime from collections import OrderedDict, namedtuple + +from lxml import etree + +import util.paths as paths from util.TranslationCatalogs import NoTranslate from plcopen import * from graphics.GraphicCommons import * diff -r 56b48961cc68 -r 0f1081928d65 PLCGenerator.py --- 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 types import * +import re from plcopen import PLCOpenParser from plcopen.structures import * -from types import * -import re + # Dictionary associating PLCOpen variable categories to the corresponding # IEC 61131-3 variable categories diff -r 56b48961cc68 -r 0f1081928d65 PLCOpenEditor.py --- 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 wx import os import sys import getopt +import wx + import version import util.paths as paths import util.ExceptionHandler - from IDEFrame import IDEFrame, AppendMenu from IDEFrame import \ TITLE, \ diff -r 56b48961cc68 -r 0f1081928d65 ProjectController.py --- 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 @@ import sys import traceback import time -import features import shutil -import wx import re import tempfile from math import ceil @@ -43,6 +41,9 @@ from weakref import WeakKeyDictionary from itertools import izip +import wx + +import features import targets import connectors import util.paths as paths diff -r 56b48961cc68 -r 0f1081928d65 connectors/PYRO/__init__.py --- 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 -import Pyro -import Pyro.core -import Pyro.util -from Pyro.errors import PyroError import traceback from time import sleep import copy import socket import os.path +import Pyro +import Pyro.core +import Pyro.util +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. diff -r 56b48961cc68 -r 0f1081928d65 connectors/WAMP/__init__.py --- 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 @@ import sys import traceback import atexit +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 + _WampSession = None _WampConnection = None diff -r 56b48961cc68 -r 0f1081928d65 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- 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 + import numpy - import wx - import matplotlib import matplotlib.pyplot 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 diff -r 56b48961cc68 -r 0f1081928d65 controls/DebugVariablePanel/DebugVariableItem.py --- 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. +import binascii import numpy -import binascii - from graphics.DebugDataConsumer import DebugDataConsumer, TYPE_TRANSLATOR # ------------------------------------------------------------------------------- diff -r 56b48961cc68 -r 0f1081928d65 controls/LogViewer.py --- 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 + import numpy - import wx 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. diff -r 56b48961cc68 -r 0f1081928d65 controls/TextCtrlAutoComplete.py --- 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. +import cPickle import wx -import cPickle MAX_ITEM_COUNT = 10 MAX_ITEM_SHOWN = 6 diff -r 56b48961cc68 -r 0f1081928d65 docutil/docsvg.py --- 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. -import wx import os import subprocess +import wx def get_inkscape_path(): diff -r 56b48961cc68 -r 0f1081928d65 editors/LDViewer.py --- 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. -import wx import time from types import * +import wx + from Viewer import * diff -r 56b48961cc68 -r 0f1081928d65 graphics/GraphicCommons.py --- 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. -import wx + from math import * from types import * import datetime from threading import Lock, Timer +import wx from graphics.ToolTipProducer import ToolTipProducer from graphics.DebugDataConsumer import DebugDataConsumer diff -r 56b48961cc68 -r 0f1081928d65 i18n/mki18n.py --- 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 import os import sys +import re import wx -import re # ----------------------------------------------------------------------------- # Global variables diff -r 56b48961cc68 -r 0f1081928d65 plcopen/plcopen.py --- 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 xmlclass import * from types import * import os import re +from collections import OrderedDict + from lxml import etree -from collections import OrderedDict + +from xmlclass import * import util.paths as paths """ diff -r 56b48961cc68 -r 0f1081928d65 plcopen/structures.py --- 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 @@ import string import re +from collections import OrderedDict + from plcopen import LoadProject -from collections import OrderedDict from definitions import * TypeHierarchy = dict(TypeHierarchy_list) diff -r 56b48961cc68 -r 0f1081928d65 runtime/PLCObject.py --- 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 import ctypes import os @@ -29,8 +29,11 @@ import types import sys import traceback +from time import time + +import Pyro.core as pyro + from targets.typemapping import LogLevelsDefault, LogLevelsCount, TypeTranslator, UnpackDebugBuffer -from time import time if os.name in ("nt", "ce"): diff -r 56b48961cc68 -r 0f1081928d65 runtime/WampClient.py --- 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 import sys +import json + 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 -import json + _WampSession = None _PySrv = None diff -r 56b48961cc68 -r 0f1081928d65 svgui/pyjs/build.py --- 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 @@ import sys import os import shutil +import time +import re +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 + import pyjs -import time -from cStringIO import StringIO -try: - # Python 2.5 and above - from hashlib import md5 -except Exception: - import md5 -import re + usage = """ usage: %prog [options] diff -r 56b48961cc68 -r 0f1081928d65 svgui/pyjs/jsonrpc/jsonrpc.py --- 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 types import sys +import gluon.contrib.simplejson as simplejson class JSONRPCServiceBase: diff -r 56b48961cc68 -r 0f1081928d65 svgui/pyjs/lib/pyjslib.py --- 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 +import sys # noqa # pylint: disable=C0411 class BaseException: diff -r 56b48961cc68 -r 0f1081928d65 svgui/svgui.py --- 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. -import wx import os import sys import shutil +import wx from pyjs import translate import util.paths as paths diff -r 56b48961cc68 -r 0f1081928d65 targets/toolchain_gcc.py --- 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 @@ import os import re import operator +import hashlib + from util.ProcessLogger import ProcessLogger -import hashlib + includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') diff -r 56b48961cc68 -r 0f1081928d65 targets/toolchain_makefile.py --- 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 @@ import os import re import operator +import hashlib +import time + from util.ProcessLogger import ProcessLogger -import hashlib -import time includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') diff -r 56b48961cc68 -r 0f1081928d65 tests/tools/check_source.sh --- 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 # enable= options= diff -r 56b48961cc68 -r 0f1081928d65 tests/tools/conftest.py --- 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 @@ import os import sys +import time + import pytest import xvfbwrapper -import time # append module root directory to sys.path sys.path.append( diff -r 56b48961cc68 -r 0f1081928d65 tests/tools/test_CustomIntCtrl.py --- 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 unittest +import time + import wx -import time import conftest import controls.CustomIntCtrl diff -r 56b48961cc68 -r 0f1081928d65 tests/tools/test_application.py --- 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 @@ import os import sys import unittest +import time +import traceback + import pytest import wx -import time -import traceback import ddt import conftest diff -r 56b48961cc68 -r 0f1081928d65 util/ProcessLogger.py --- 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 @@ import os import sys import time -import wx import subprocess import ctypes from threading import Timer, Lock, Thread, Semaphore +import wx if os.name == 'posix': from signal import SIGTERM, SIGKILL diff -r 56b48961cc68 -r 0f1081928d65 wxglade_hmi/wxglade_hmi.py --- 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. -import wx + import os import sys import shutil from xml.dom import minidom +import wx + import util.paths as paths from py_ext import PythonFileCTNMixin diff -r 56b48961cc68 -r 0f1081928d65 xmlclass/xmlclass.py --- 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 types import * from xml.dom import minidom from xml.sax.saxutils import escape, unescape, quoteattr -from lxml import etree from new import classobj from collections import OrderedDict +from lxml import etree + def CreateNode(name): node = minidom.Node()