fix (old-style-class) Old-style class defined error for most parts of
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Sep 2017 12:20:40 +0300
changeset 1831 56b48961cc68
parent 1830 e598d1acf354
child 1832 0f1081928d65
fix (old-style-class) Old-style class defined error for most parts of
the code

only PyJS code is left, because it does some fancy tricks and can't be
easily fixed. So far PyJS doesn't support Python3 anyway.
Beremiz.py
BeremizIDE.py
Beremiz_service.py
CodeFileTreeNode.py
ConfigTreeNode.py
PLCControler.py
PLCGenerator.py
POULibrary.py
ProjectController.py
canfestival/canfestival.py
canfestival/config_utils.py
controls/DebugVariablePanel/DebugVariableViewer.py
controls/DebugVariablePanel/GraphButton.py
controls/LogViewer.py
editors/DebugViewer.py
graphics/DebugDataConsumer.py
graphics/RubberBand.py
graphics/ToolTipProducer.py
plcopen/plcopen.py
runtime/NevowServer.py
runtime/PLCObject.py
runtime/ServicePublisher.py
svgui/svgui_server.py
targets/toolchain_gcc.py
targets/toolchain_makefile.py
tests/tools/check_source.sh
util/MiniTextControler.py
util/ProcessLogger.py
xmlclass/xmlclass.py
--- a/Beremiz.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/Beremiz.py	Thu Sep 28 12:20:40 2017 +0300
@@ -31,7 +31,7 @@
 import util.paths as paths
 
 
-class BeremizIDELauncher:
+class BeremizIDELauncher(object):
     def __init__(self):
         self.app = None
         self.frame = None
--- a/BeremizIDE.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/BeremizIDE.py	Thu Sep 28 12:20:40 2017 +0300
@@ -115,7 +115,7 @@
 REFRESH_PERIOD = 0.1
 
 
-class LogPseudoFile:
+class LogPseudoFile(object):
     """ Base class for file like objects to facilitate StdOut for the Shell."""
     def __init__(self, output, risecall):
         self.red_white = 1
--- a/Beremiz_service.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/Beremiz_service.py	Thu Sep 28 12:20:40 2017 +0300
@@ -393,7 +393,7 @@
     return res
 
 
-class Server():
+class Server(object):
     def __init__(self, servicename, ip_addr, port,
                  workdir, argv, autostart=False,
                  statuschange=None, evaluator=default_evaluator,
--- a/CodeFileTreeNode.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/CodeFileTreeNode.py	Thu Sep 28 12:20:40 2017 +0300
@@ -83,7 +83,7 @@
 SECTION_TAG_ELEMENT = "<xsd:element name=\"%s\" type=\"CodeText\"/>"
 
 
-class CodeFile:
+class CodeFile(object):
 
     CODEFILE_NAME = "CodeFile"
     SECTIONS_NAMES = []
--- a/ConfigTreeNode.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/ConfigTreeNode.py	Thu Sep 28 12:20:40 2017 +0300
@@ -58,7 +58,7 @@
 XSDSchemaErrorMessage = _("{a1} XML file doesn't follow XSD schema at line {a2}:\n{a3}")
 
 
-class ConfigTreeNode:
+class ConfigTreeNode(object):
     """
     This class is the one that define confnodes.
     """
--- a/PLCControler.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/PLCControler.py	Thu Sep 28 12:20:40 2017 +0300
@@ -169,7 +169,7 @@
         return _VariableInfos(*[getattr(self, attr) for attr in self.__slots__])
 
 
-class VariablesInfosFactory:
+class VariablesInfosFactory(object):
 
     def __init__(self, variables):
         self.Variables = variables
@@ -242,7 +242,7 @@
         return _VariableTreeItem(*[getattr(self, attr) for attr in self.__slots__])
 
 
-class VariablesTreeInfosFactory:
+class VariablesTreeInfosFactory(object):
 
     def __init__(self):
         self.Root = None
@@ -264,7 +264,7 @@
                     [_BoolValue] * 2, args) + [[]])))
 
 
-class InstancesPathFactory:
+class InstancesPathFactory(object):
     """Helpers object for generating instances path list"""
     def __init__(self, instances):
         self.Instances = instances
@@ -273,7 +273,7 @@
         self.Instances.append(args[0][0])
 
 
-class InstanceTagName:
+class InstanceTagName(object):
     """Helpers object for generating instance tagname"""
 
     def __init__(self, controller):
@@ -387,7 +387,7 @@
         return _ActionInfos(*[getattr(self, attr) for attr in self.__slots__])
 
 
-class BlockInstanceFactory:
+class BlockInstanceFactory(object):
 
     def __init__(self, block_instances):
         self.BlockInstances = block_instances
@@ -461,7 +461,7 @@
 UNDO_BUFFER_LENGTH = 20
 
 
-class UndoBuffer:
+class UndoBuffer(object):
     """
     Undo Buffer for PLCOpenEditor
     Class implementing a buffer of changes made on the current editing model
@@ -544,7 +544,7 @@
         return self.LastSave == self.CurrentIndex
 
 
-class PLCControler:
+class PLCControler(object):
     """
     Controler for PLCOpenEditor
     Class which controls the operations made on the plcopen model and answers to view requests
--- a/PLCGenerator.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/PLCGenerator.py	Thu Sep 28 12:20:40 2017 +0300
@@ -99,7 +99,7 @@
 # -------------------------------------------------------------------------------
 
 
-class ProgramGenerator:
+class ProgramGenerator(object):
 
     # Create a new PCL program generator
     def __init__(self, controler, project, errors, warnings):
@@ -505,7 +505,7 @@
 ActionObjClass = PLCOpenParser.GetElementClass("action", "actions")
 
 
-class PouProgramGenerator:
+class PouProgramGenerator(object):
 
     # Create a new POU program generator
     def __init__(self, parent, name, type, errors, warnings):
--- a/POULibrary.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/POULibrary.py	Thu Sep 28 12:20:40 2017 +0300
@@ -25,7 +25,7 @@
 from weakref import ref
 
 
-class POULibrary:
+class POULibrary(object):
     def __init__(self, CTR, LibName, TypeStack):
         from PLCControler import PLCControler
         self.CTR = ref(CTR)
--- a/ProjectController.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/ProjectController.py	Thu Sep 28 12:20:40 2017 +0300
@@ -93,7 +93,7 @@
     return ExtractMenuItemsFromCatalog(features.catalog)
 
 
-class Iec2CSettings():
+class Iec2CSettings(object):
     def __init__(self):
         self.iec2c = None
         self.iec2c_buildopts = None
--- a/canfestival/canfestival.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/canfestival/canfestival.py	Thu Sep 28 12:20:40 2017 +0300
@@ -483,7 +483,7 @@
         return self.Manager.GetCurrentBufferState()
 
 
-class RootClass:
+class RootClass(object):
     XSD = """<?xml version="1.0" encoding="ISO-8859-1" ?>
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:element name="CanFestivalInstance">
--- a/canfestival/config_utils.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/canfestival/config_utils.py	Thu Sep 28 12:20:40 2017 +0300
@@ -156,7 +156,7 @@
     return "".join(dcfdata), len(dcfdata)
 
 
-class ConciseDCFGenerator:
+class ConciseDCFGenerator(object):
 
     def __init__(self, nodelist, nodename):
         # Dictionary of location informations classed by name
--- a/controls/DebugVariablePanel/DebugVariableViewer.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableViewer.py	Thu Sep 28 12:20:40 2017 +0300
@@ -49,7 +49,7 @@
 # -------------------------------------------------------------------------------
 
 
-class DebugVariableViewer:
+class DebugVariableViewer(object):
     """
     Class that implements a generic viewer that display a list of variable values
     This class has to be inherited to effectively display variable values
--- a/controls/DebugVariablePanel/GraphButton.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/controls/DebugVariablePanel/GraphButton.py	Thu Sep 28 12:20:40 2017 +0300
@@ -31,7 +31,7 @@
 # -------------------------------------------------------------------------------
 
 
-class GraphButton():
+class GraphButton(object):
     """
     Class that implements a custom button for graphic Viewer
     """
--- a/controls/LogViewer.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/controls/LogViewer.py	Thu Sep 28 12:20:40 2017 +0300
@@ -183,7 +183,7 @@
 BUTTON_SIZE = (70, 15)
 
 
-class LogButton():
+class LogButton(object):
 
     def __init__(self, label, callback):
         self.Position = wx.Point(0, 0)
@@ -229,7 +229,7 @@
 MESSAGE_INFO_SIZE = 18
 
 
-class LogMessage:
+class LogMessage(object):
 
     def __init__(self, tv_sec, tv_nsec, level, level_bitmap, msg):
         self.Date = datetime.utcfromtimestamp(tv_sec)
--- a/editors/DebugViewer.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/editors/DebugViewer.py	Thu Sep 28 12:20:40 2017 +0300
@@ -35,7 +35,7 @@
 # -------------------------------------------------------------------------------
 
 
-class DebugViewer:
+class DebugViewer(object):
     """
     Class that implements common behavior of every viewers able to display debug
     values
--- a/graphics/DebugDataConsumer.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/graphics/DebugDataConsumer.py	Thu Sep 28 12:20:40 2017 +0300
@@ -156,7 +156,7 @@
 # -------------------------------------------------------------------------------
 
 
-class DebugDataConsumer:
+class DebugDataConsumer(object):
     """
     Class that implements an element that consumes debug values
     Value update can be inhibited during the time the associated Debug Viewer is
--- a/graphics/RubberBand.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/graphics/RubberBand.py	Thu Sep 28 12:20:40 2017 +0300
@@ -32,7 +32,7 @@
 # -------------------------------------------------------------------------------
 
 
-class RubberBand:
+class RubberBand(object):
     """
     Class that implements a rubberband for graphic Viewers
     """
--- a/graphics/ToolTipProducer.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/graphics/ToolTipProducer.py	Thu Sep 28 12:20:40 2017 +0300
@@ -32,7 +32,7 @@
 # -------------------------------------------------------------------------------
 
 
-class ToolTipProducer:
+class ToolTipProducer(object):
     """
     Class that implements an element that generate Tool Tip
     """
--- a/plcopen/plcopen.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/plcopen/plcopen.py	Thu Sep 28 12:20:40 2017 +0300
@@ -84,7 +84,7 @@
     return v1
 
 
-class rect:
+class rect(object):
     """
     Helper class for bounding_box calculation
     """
--- a/runtime/NevowServer.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/runtime/NevowServer.py	Thu Sep 28 12:20:40 2017 +0300
@@ -191,7 +191,7 @@
     return website
 
 
-class statuslistener:
+class statuslistener(object):
     def __init__(self, site):
         self.oldstate = None
         self.site = site
--- a/runtime/PLCObject.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/runtime/PLCObject.py	Thu Sep 28 12:20:40 2017 +0300
@@ -277,7 +277,7 @@
         self.python_runtime_vars = globals().copy()
         self.python_runtime_vars.update(self.pyruntimevars)
 
-        class PLCSafeGlobals:
+        class PLCSafeGlobals(object):
             def __getattr__(_self, name):
                 try:
                     t = self.python_runtime_vars["_"+name+"_ctype"]
--- a/runtime/ServicePublisher.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/runtime/ServicePublisher.py	Thu Sep 28 12:20:40 2017 +0300
@@ -30,7 +30,7 @@
 service_type = '_PYRO._tcp.local.'
 
 
-class ServicePublisher():
+class ServicePublisher(object):
     def __init__(self):
         # type: fully qualified service type name
         self.serviceproperties = {'description': 'Beremiz remote PLC'}
--- a/svgui/svgui_server.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/svgui/svgui_server.py	Thu Sep 28 12:20:40 2017 +0300
@@ -40,7 +40,7 @@
     return currentId
 
 
-class SvguiWidget:
+class SvguiWidget(object):
 
     def __init__(self, classname, id, **kwargs):
         self.classname = classname
--- a/targets/toolchain_gcc.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/targets/toolchain_gcc.py	Thu Sep 28 12:20:40 2017 +0300
@@ -32,7 +32,7 @@
 includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
 
 
-class toolchain_gcc():
+class toolchain_gcc(object):
     """
     This abstract class contains GCC specific code.
     It cannot be used as this and should be inherited in a target specific
--- a/targets/toolchain_makefile.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/targets/toolchain_makefile.py	Thu Sep 28 12:20:40 2017 +0300
@@ -33,7 +33,7 @@
 includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
 
 
-class toolchain_makefile():
+class toolchain_makefile(object):
     def __init__(self, CTRInstance):
         self.CTRInstance = CTRInstance
         self.md5key = None
--- a/tests/tools/check_source.sh	Fri Sep 22 20:12:22 2017 +0300
+++ b/tests/tools/check_source.sh	Thu Sep 28 12:20:40 2017 +0300
@@ -201,11 +201,14 @@
     disable=$disable,W0511 # fixme
 
     enable=
-    enable=$enable,E1601          # print statement used    
-    enable=$enable,C0325          # (superfluous-parens) Unnecessary parens after keyword
+    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,W0403        # relative import
+    # enable=$enable,W0622        # (redefined-builtin) Redefining built-in
+    # enable=$enable,W0612        # unused-variable
 
     # enable=
 
--- a/util/MiniTextControler.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/util/MiniTextControler.py	Thu Sep 28 12:20:40 2017 +0300
@@ -29,7 +29,7 @@
 import os
 
 
-class MiniTextControler:
+class MiniTextControler(object):
 
     def __init__(self, filepath, controller):
         self.FilePath = filepath
--- a/util/ProcessLogger.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/util/ProcessLogger.py	Thu Sep 28 12:20:40 2017 +0300
@@ -72,7 +72,7 @@
             self.endcallback(self.Proc.pid, err)
 
 
-class ProcessLogger:
+class ProcessLogger(object):
     def __init__(self, logger, Command, finish_callback=None,
                  no_stdout=False, no_stderr=False, no_gui=True,
                  timeout=None, outlimit=None, errlimit=None,
--- a/xmlclass/xmlclass.py	Fri Sep 22 20:12:22 2017 +0300
+++ b/xmlclass/xmlclass.py	Thu Sep 28 12:20:40 2017 +0300
@@ -752,7 +752,7 @@
     return ExtractElement
 
 
-class ClassFactory:
+class ClassFactory(object):
     """
     Class that generate class from an XML Tree
     """