# HG changeset patch # User Andrey Skvortsov # Date 1528553696 -10800 # Node ID eeca1aff06917549929ba170b4bc920602704a41 # Parent 52630996e51b973c3930a93a5ddf63d2bb55006f Fix linter errors diff -r 52630996e51b -r eeca1aff0691 ConfigTreeNode.py --- a/ConfigTreeNode.py Sat Jun 09 17:13:16 2018 +0300 +++ b/ConfigTreeNode.py Sat Jun 09 17:14:56 2018 +0300 @@ -501,7 +501,7 @@ # Delete confnode dir try: shutil.rmtree(CTNInstance.CTNPath()) - except: + except Exception: pass # Remove child of Children self.Children[CTNInstance.CTNType].remove(CTNInstance) diff -r 52630996e51b -r eeca1aff0691 connectors/PYRO/dialog.py --- a/connectors/PYRO/dialog.py Sat Jun 09 17:13:16 2018 +0300 +++ b/connectors/PYRO/dialog.py Sat Jun 09 17:14:56 2018 +0300 @@ -10,8 +10,9 @@ from __future__ import print_function import wx +from zope.interface import implementer + from controls.UriLocationEditor import IConnectorPanel -from zope.interface import implementer URITypes = ["LOCAL", "PYRO", "PYROS"] @@ -19,7 +20,6 @@ def PYRO_connector_dialog(confnodesroot): [ID_IPTEXT, ID_PORTTEXT] = [wx.NewId() for _init_ctrls in range(2)] - @implementer(IConnectorPanel) class PYROConnectorPanel(wx.Panel): def __init__(self, typeConnector, parrent, *args, **kwargs): @@ -31,8 +31,8 @@ self.uri = None def _init_ctrls(self): - self.IpText = wx.TextCtrl(parent=self, id=ID_IPTEXT, size = wx.Size(200, -1)) - self.PortText = wx.TextCtrl(parent=self, id=ID_PORTTEXT, size = wx.Size(200, -1)) + self.IpText = wx.TextCtrl(parent=self, id=ID_IPTEXT, size=wx.Size(200, -1)) + self.PortText = wx.TextCtrl(parent=self, id=ID_PORTTEXT, size=wx.Size(200, -1)) def _init_sizers(self): self.mainSizer = wx.FlexGridSizer(cols=2, hgap=10, rows=5, vgap=10) @@ -55,7 +55,6 @@ elif length == 2: self.IpText.SetValue(uri_list[1].strip("/")) - def GetURI(self): self.uri = self.type+"://"+self.IpText.GetValue()+":"+self.PortText.GetValue() return self.uri diff -r 52630996e51b -r eeca1aff0691 connectors/WAMP/dialog.py --- a/connectors/WAMP/dialog.py Sat Jun 09 17:13:16 2018 +0300 +++ b/connectors/WAMP/dialog.py Sat Jun 09 17:14:56 2018 +0300 @@ -8,9 +8,11 @@ from __future__ import absolute_import from __future__ import print_function + import wx +from zope.interface import implementer + from controls.UriLocationEditor import IConnectorPanel -from zope.interface import implementer URITypes = ["WAMP", "WAMPS"] @@ -18,7 +20,6 @@ def WAMP_connector_dialog(confnodesroot): [ID_IPTEXT, ID_PORTTEXT, ID_REALMTEXT, ID_WAMPIDTEXT, ID_SECURECHECKBOX] = [wx.NewId() for _init_ctrls in range(5)] - @implementer(IConnectorPanel) class WAMPConnectorPanel(wx.Panel): def __init__(self, typeConnector, parrent, *args, **kwargs): @@ -30,10 +31,10 @@ self.uri = None def _init_ctrls(self): - self.IpText = wx.TextCtrl(parent=self, id=ID_IPTEXT, size = wx.Size(200, -1)) - self.PortText = wx.TextCtrl(parent=self, id=ID_PORTTEXT, size = wx.Size(200, -1)) - self.RealmText = wx.TextCtrl(parent=self, id=ID_REALMTEXT, size = wx.Size(200, -1)) - self.WAMPIDText = wx.TextCtrl(parent=self, id=ID_WAMPIDTEXT, size = wx.Size(200, -1)) + self.IpText = wx.TextCtrl(parent=self, id=ID_IPTEXT, size=wx.Size(200, -1)) + self.PortText = wx.TextCtrl(parent=self, id=ID_PORTTEXT, size=wx.Size(200, -1)) + self.RealmText = wx.TextCtrl(parent=self, id=ID_REALMTEXT, size=wx.Size(200, -1)) + self.WAMPIDText = wx.TextCtrl(parent=self, id=ID_WAMPIDTEXT, size=wx.Size(200, -1)) self.SecureCheckbox = wx.CheckBox(self, ID_SECURECHECKBOX, _("Is connection secure?")) def _init_sizers(self): diff -r 52630996e51b -r eeca1aff0691 connectors/__init__.py --- a/connectors/__init__.py Sat Jun 09 17:13:16 2018 +0300 +++ b/connectors/__init__.py Sat Jun 09 17:14:56 2018 +0300 @@ -36,9 +36,11 @@ def _GetLocalConnectorClassFactory(name): return lambda: getattr(__import__(name, globals(), locals()), name + "_connector_factory") + def _GetLocalConnectorClassDialog(name): return lambda: getattr(__import__(name + '.dialog', globals(), locals(), fromlist=['dialog']), name + "_connector_dialog") + def _GetLocalConnectorURITypes(name): return lambda: getattr(__import__(name + '.dialog', globals(), locals(), fromlist=['dialog']), "URITypes", None) @@ -50,7 +52,7 @@ not name.startswith("__"))} connectors_dialog = {name: - {"function":_GetLocalConnectorClassDialog(name), "URITypes": _GetLocalConnectorURITypes(name)} + {"function": _GetLocalConnectorClassDialog(name), "URITypes": _GetLocalConnectorURITypes(name)} for name in listdir(_base_path) if (path.isdir(path.join(_base_path, name)) and not name.startswith("__"))} @@ -81,6 +83,7 @@ connectorclass = connectors[servicetype]() return connectorclass(uri, confnodesroot) + def ConnectorDialog(conn_type, confnodesroot): if conn_type not in connectors_dialog: return None @@ -88,6 +91,7 @@ connectorclass = connectors_dialog[conn_type]["function"]() return connectorclass(confnodesroot) + def GetConnectorFromURI(uri): typeOfConnector = None for conn_type in connectors_dialog: diff -r 52630996e51b -r eeca1aff0691 controls/UriLocationEditor.py --- a/controls/UriLocationEditor.py Sat Jun 09 17:13:16 2018 +0300 +++ b/controls/UriLocationEditor.py Sat Jun 09 17:14:56 2018 +0300 @@ -1,54 +1,57 @@ +from __future__ import absolute_import + import wx from zope.interface import Interface, Attribute from zope.interface.verify import verifyObject from connectors import connectors_dialog, ConnectorDialog, GetConnectorFromURI -[ID_URIWIZARDDIALOG,ID_URITYPECHOICE] = [wx.NewId() for _init_ctrls in range(2)] +[ID_URIWIZARDDIALOG, ID_URITYPECHOICE] = [wx.NewId() for _init_ctrls in range(2)] + class IConnectorPanel(Interface): """This is interface for panel of seperate connector type""" uri = Attribute("""uri of connections""") type = Attribute("""type of connector""") - def SetURI(uri): + def SetURI(uri): # pylint: disable=no-self-argument """methode for set uri""" - def GetURI(): + def GetURI(): # pylint: disable=no-self-argument """metohde for get uri""" class UriLocationEditor(wx.Dialog): def _init_ctrls(self, parent): - wx.Dialog.__init__(self, id=ID_URIWIZARDDIALOG, - name='UriLocationEditor', parent=parent, - title='Uri location') - self.UriTypeChoice = wx.Choice(parent=self, id=ID_URIWIZARDDIALOG, choices = self.URITYPES) + self.UriTypeChoice = wx.Choice(parent=self, id=ID_URIWIZARDDIALOG, choices=self.URITYPES) self.UriTypeChoice.SetSelection(0) self.Bind(wx.EVT_CHOICE, self.OnTypeChoice, self.UriTypeChoice) self.PanelSizer = wx.BoxSizer(wx.HORIZONTAL) - self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL) + self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) def _init_sizers(self): self.mainSizer = wx.BoxSizer(wx.VERTICAL) typeSizer = wx.BoxSizer(wx.HORIZONTAL) - typeSizer.Add(wx.StaticText(self,wx.ID_ANY, _("URI type:")), border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL) + typeSizer.Add(wx.StaticText(self, wx.ID_ANY, _("URI type:")), border=5, flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL) typeSizer.Add(self.UriTypeChoice, border=5, flag=wx.ALL) self.mainSizer.Add(typeSizer) self.mainSizer.Add(self.PanelSizer, border=5, flag=wx.ALL) - self.mainSizer.Add(self.ButtonSizer, border=5, flag=wx.BOTTOM|wx.ALIGN_CENTER_HORIZONTAL) + self.mainSizer.Add(self.ButtonSizer, border=5, flag=wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL) self.SetSizer(self.mainSizer) self.Layout() self.Fit() def __init__(self, parent, uri): + wx.Dialog.__init__(self, id=ID_URIWIZARDDIALOG, + name='UriLocationEditor', parent=parent, + title='Uri location') self.URITYPES = [_("- Select URI type -")] for connector_type, connector_function in connectors_dialog.iteritems(): try: connector_function['function']() self.URITYPES.append(connector_type) - except Exception as e: + except Exception: pass self.selected = None diff -r 52630996e51b -r eeca1aff0691 editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Sat Jun 09 17:13:16 2018 +0300 +++ b/editors/ConfTreeNodeEditor.py Sat Jun 09 17:14:56 2018 +0300 @@ -359,7 +359,6 @@ dialog.Destroy() - def GenerateSizerElements(self, sizer, elements, path, clean=True): if clean: sizer.Clear(True) diff -r 52630996e51b -r eeca1aff0691 modbus/modbus.py --- a/modbus/modbus.py Sat Jun 09 17:13:16 2018 +0300 +++ b/modbus/modbus.py Sat Jun 09 17:14:56 2018 +0300 @@ -598,7 +598,7 @@ for j in range(i + 1, len(IPServer_port_numbers)): if IPServer_port_numbers[i][1] == IPServer_port_numbers[j][1]: self.GetCTRoot().logger.write_warning( - _("Error: Modbus/IP Servers %{a1}.x and %{a2}.x use the same port number {a3}.\n").\ + _("Error: Modbus/IP Servers %{a1}.x and %{a2}.x use the same port number {a3}.\n"). format( a1=_lt_to_str(IPServer_port_numbers[i][0]), a2=_lt_to_str(IPServer_port_numbers[j][0]), diff -r 52630996e51b -r eeca1aff0691 tests/tools/check_source.sh --- a/tests/tools/check_source.sh Sat Jun 09 17:13:16 2018 +0300 +++ b/tests/tools/check_source.sh Sat Jun 09 17:14:56 2018 +0300 @@ -217,7 +217,7 @@ disable=$disable,W1401 # (anomalous-backslash-in-string) Anomalous backslash in string: '\.'. String constant might be missing an r prefix. disable=$disable,W0613 # (unused-argument) Unused argument 'X' disable=$disable,W0622 # (redefined-builtin) Redefining built-in - disable=$disable,W0621 # (redefined-outer-name) Redefining name 'Y' from outer scope (line X) + disable=$disable,W0621 # (redefined-outer-name) Redefining name 'Y' from outer scope (line X) disable=$disable,W0122 # (exec-used) Use of exec disable=$disable,W0123 # (eval-used) Use of eval disable=$disable,I0011 # (locally-disabled) Locally disabling ungrouped-imports (C0412) @@ -231,7 +231,7 @@ disable=$disable,W0703 # broad-except disable=$disable,C0301 # Line too long disable=$disable,C0302 # Too many lines in module - disable=$disable,W0511 # fixme + disable=$disable,W0511 # fixme disable=$disable,R0901 # (too-many-ancestors) Too many ancestors (9/7) disable=$disable,R0902 # (too-many-instance-attributes) Too many instance attributes (10/7) disable=$disable,R0903 # (too-few-public-methods) Too few public methods (0/2) @@ -248,14 +248,14 @@ enable= enable=$enable,E1601 # print statement used - enable=$enable,C0325 # (superfluous-parens) Unnecessary parens after keyword - enable=$enable,W0404 # reimported module + 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,C0412 # (ungrouped-imports) Imports from package X are not grouped enable=$enable,C0321 # (multiple-statements) More than one statement on a single line enable=$enable,W0231 # (super-init-not-called) __init__ method from base class is not called - enable=$enable,W0105 # (pointless-string-statement) String statement has no effect + enable=$enable,W0105 # (pointless-string-statement) String statement has no effect enable=$enable,W0311 # (bad-indentation) Bad indentation. Found 16 spaces, expected 12 enable=$enable,W0101 # (unreachable) Unreachable code enable=$enable,E0102 # (function-redefined) method already defined @@ -304,7 +304,7 @@ fi # echo $options - echo $py_files | xargs pylint $options + echo $py_files | xargs pylint $options if [ $? -ne 0 ]; then set_exit_error fi @@ -316,7 +316,7 @@ get_files_to_check() { - py_files=$(find . -name '*.py' -not -path '*/build/*') + py_files=$(find . -name '*.py' -not -path '*/build/*') if [ "$1" = "--only-changes" ]; then if which hg > /dev/null; then echo "Only changes will be checked"