# HG changeset patch # User Andrey Skvortsov # Date 1507210729 -10800 # Node ID 6198190bc121c74d91a4611732a6a103ed47f8cf # Parent 14b40afccd69577e96a40fb3ca0dc1d89e4850de explicitly mark unused variables found by pylint with _ or dummy pylint don't ignores unused variables with '_' in the name, even when they are started with '_'. This bug is already fixed upstream, to fix this in all versions of pylint custom dummy-variables-rgx is used '_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy' diff -r 14b40afccd69 -r 6198190bc121 .pylint --- a/.pylint Tue Oct 03 16:31:31 2017 +0300 +++ b/.pylint Thu Oct 05 16:38:49 2017 +0300 @@ -106,7 +106,7 @@ # A regular expression matching the name of dummy variables (i.e. expectedly # not used). -dummy-variables-rgx=(_+[a-zA-Z0-9]*?$)|dummy +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. diff -r 14b40afccd69 -r 6198190bc121 Beremiz.py --- a/Beremiz.py Tue Oct 03 16:31:31 2017 +0300 +++ b/Beremiz.py Thu Oct 05 16:38:49 2017 +0300 @@ -57,7 +57,7 @@ self.splash.Show() self.splash.ProcessEvent(wx.PaintEvent()) else: - for i in range(0, 30): + for dummy in range(0, 30): wx.Yield() time.sleep(0.01) diff -r 14b40afccd69 -r 6198190bc121 BeremizIDE.py --- a/BeremizIDE.py Tue Oct 03 16:31:31 2017 +0300 +++ b/BeremizIDE.py Thu Oct 05 16:38:49 2017 +0300 @@ -452,7 +452,7 @@ if projectOpen is not None and os.path.isdir(projectOpen): self.CTR = ProjectController(self, self.Log) self.Controler = self.CTR - result, err = self.CTR.LoadProject(projectOpen, buildpath) + result, _err = self.CTR.LoadProject(projectOpen, buildpath) if not result: self.LibraryPanel.SetController(self.Controler) self.ProjectTree.Enable(True) @@ -558,7 +558,7 @@ if self.CTR is not None: result = MATIEC_ERROR_MODEL.match(line) if result is not None: - first_line, first_column, last_line, last_column, error = result.groups() + first_line, first_column, last_line, last_column, _error = result.groups() self.CTR.ShowError(self.Log, (int(first_line), int(first_column)), (int(last_line), int(last_column))) @@ -729,7 +729,7 @@ elif kind == wx.ITEM_SEPARATOR: menu.AppendSeparator() else: - text, id, help, callback = infos + text, id, _help, callback = infos AppendMenu(menu, help='', id=id, kind=kind, text=text) if callback is not None: self.Bind(wx.EVT_MENU, callback, id=id) diff -r 14b40afccd69 -r 6198190bc121 Beremiz_service.py --- a/Beremiz_service.py Tue Oct 03 16:31:31 2017 +0300 +++ b/Beremiz_service.py Thu Oct 05 16:38:49 2017 +0300 @@ -28,6 +28,7 @@ import os import sys import getopt +import gettext import threading from threading import Thread, currentThread, Semaphore import traceback @@ -132,9 +133,6 @@ def SetupI18n(): - # Import module for internationalization - import gettext - # Get folder containing translation files localedir = os.path.join(beremiz_dir, "locale") # Get the default language diff -r 14b40afccd69 -r 6198190bc121 ConfigTreeNode.py --- a/ConfigTreeNode.py Tue Oct 03 16:31:31 2017 +0300 +++ b/ConfigTreeNode.py Thu Oct 05 16:38:49 2017 +0300 @@ -303,7 +303,7 @@ return LocationCFilesAndCFLAGS, LDFLAGS, extra_files def IterChildren(self): - for CTNType, Children in self.Children.items(): + for _CTNType, Children in self.Children.items(): for CTNInstance in Children: yield CTNInstance diff -r 14b40afccd69 -r 6198190bc121 IDEFrame.py --- a/IDEFrame.py Tue Oct 03 16:31:31 2017 +0300 +++ b/IDEFrame.py Thu Oct 05 16:38:49 2017 +0300 @@ -787,7 +787,7 @@ # ------------------------------------------------------------------------------- def GetTabInfos(self, tab): - for page_name, (page_ref, page_title) in self.MainTabs.iteritems(): + for page_name, (page_ref, _page_title) in self.MainTabs.iteritems(): if page_ref == tab: return ("main", page_name) return None @@ -841,7 +841,7 @@ if "split" in tabs: self.LoadTabLayout(notebook, tabs["others"]) - split_dir, split_ratio = tabs["split"] + split_dir, _split_ratio = tabs["split"] first_index = self.LoadTabLayout(notebook, tabs["tab"], mode="first") notebook.Split(first_index, split_dir) self.LoadTabLayout(notebook, tabs["tab"], mode="others", first_index=first_index) @@ -866,7 +866,7 @@ self.AUIManager.LoadPerspective(self.DefaultPerspective["perspective"]) for notebook in [self.LeftNoteBook, self.BottomNoteBook, self.RightNoteBook]: - for idx in xrange(notebook.GetPageCount()): + for dummy in xrange(notebook.GetPageCount()): notebook.RemovePage(0) notebooks = self.DefaultPerspective["notebooks"] @@ -1015,7 +1015,7 @@ """Function that fix difference in deleting all tabs between wx.Notebook and wx.aui.AUINotebook. """ - for idx in xrange(self.TabsOpened.GetPageCount()): + for dummy in xrange(self.TabsOpened.GetPageCount()): self.TabsOpened.DeletePage(0) self.RefreshTabCtrlEvent() @@ -2641,7 +2641,7 @@ dc.SetFont(wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) dc.SetTextForeground(wx.BLACK) block_name = " - ".join(self.Viewer.GetTagName().split("::")[1:]) - text_width, text_height = dc.GetTextExtent(block_name) + _text_width, text_height = dc.GetTextExtent(block_name) dc.DrawText(block_name, margin_left, margin_top - text_height - self.TextMargin) dc.DrawText(_("Page: %d") % page, margin_left, margin_top + area_height + self.TextMargin) diff -r 14b40afccd69 -r 6198190bc121 PLCControler.py --- a/PLCControler.py Tue Oct 03 16:31:31 2017 +0300 +++ b/PLCControler.py Thu Oct 05 16:38:49 2017 +0300 @@ -1171,7 +1171,7 @@ # Found the pou action corresponding to old name and change its name to new name pou = self.Project.getpou(pou_name) if pou is not None: - for type, varlist in pou.getvars(): + for _type, varlist in pou.getvars(): for var in varlist.getvariable(): if var.getname() == old_name: var.setname(new_name) @@ -1328,7 +1328,7 @@ var_type = PLCOpenParser.CreateElement("type", "variable") if isinstance(var.Type, TupleType): if var.Type[0] == "array": - array_type, base_type_name, dimensions = var.Type + _array_type, base_type_name, dimensions = var.Type array = PLCOpenParser.CreateElement("array", "dataType") baseType = PLCOpenParser.CreateElement("baseType", "array") array.setbaseType(baseType) @@ -1417,7 +1417,7 @@ if configuration is not None: # Set configuration global vars configuration.setglobalVars([ - varlist for vartype, varlist + varlist for _vartype, varlist in self.ExtractVarLists(vars)]) # Return the configuration globalvars @@ -1455,7 +1455,7 @@ # Set resource global vars if resource is not None: resource.setglobalVars([ - varlist for vartype, varlist + varlist for _vartype, varlist in self.ExtractVarLists(vars)]) # Return the resource globalvars @@ -1506,7 +1506,7 @@ if pou.interface is None: pou.interface = PLCOpenParser.CreateElement("interface", "pou") # Set Pou interface - pou.setvars([varlist for varlist_type, varlist in self.ExtractVarLists(vars)]) + pou.setvars([varlist for _varlist_type, varlist in self.ExtractVarLists(vars)]) # Replace the return type of the pou given by its name (only for functions) def SetPouInterfaceReturnType(self, name, return_type): @@ -1631,9 +1631,9 @@ # Function that returns the block definition associated to the block type given def GetBlockType(self, typename, inputs=None, debug=False): result_blocktype = None - for sectioname, blocktype in self.TotalTypesDict.get(typename, []): + for _sectioname, blocktype in self.TotalTypesDict.get(typename, []): if inputs is not None and inputs != "undefined": - block_inputs = tuple([var_type for name, var_type, modifier in blocktype["inputs"]]) + block_inputs = tuple([var_type for _name, var_type, _modifier in blocktype["inputs"]]) if reduce(lambda x, y: x and y, map(lambda x: x[0] == "ANY" or self.IsOfType(*x), zip(inputs, block_inputs)), True): return blocktype else: @@ -1656,7 +1656,7 @@ return blocktype_infos if inputs == tuple([var_type - for name, var_type, modifier in blocktype_infos["inputs"]]): + for _name, var_type, _modifier in blocktype_infos["inputs"]]): return blocktype_infos return None @@ -1698,7 +1698,7 @@ name = words[1] blocktypes = [] for blocks in self.TotalTypesDict.itervalues(): - for sectioname, block in blocks: + for _sectioname, block in blocks: if block["type"] == "functionBlock": blocktypes.append(block["name"]) if project is not None: @@ -1807,7 +1807,7 @@ TypeHierarchy_list has a rough order to it (e.g. SINT, INT, DINT, ...), which makes it easy for a user to find a type in a menu. ''' - return [x for x, y in TypeHierarchy_list if not x.startswith("ANY")] + return [x for x, _y in TypeHierarchy_list if not x.startswith("ANY")] def IsOfType(self, typename, reference, debug=False): if reference is None or typename == reference: @@ -2131,7 +2131,7 @@ element_type = PLCOpenParser.CreateElement("type", "variable") if isinstance(element_infos["Type"], TupleType): if element_infos["Type"][0] == "array": - array_type, base_type_name, dimensions = element_infos["Type"] + _array_type, base_type_name, dimensions = element_infos["Type"] array = PLCOpenParser.CreateElement("array", "dataType") baseType = PLCOpenParser.CreateElement("baseType", "array") array.setbaseType(baseType) @@ -2373,7 +2373,7 @@ def PasteEditedElementInstances(self, tagname, text, new_pos, middle=False, debug=False): element = self.GetEditedElement(tagname, debug) - element_name, element_type = self.GetEditedElementType(tagname, debug) + _element_name, element_type = self.GetEditedElementType(tagname, debug) if element is not None: bodytype = element.getbodyType() diff -r 14b40afccd69 -r 6198190bc121 PLCGenerator.py --- a/PLCGenerator.py Tue Oct 03 16:31:31 2017 +0300 +++ b/PLCGenerator.py Thu Oct 05 16:38:49 2017 +0300 @@ -61,7 +61,7 @@ while lines[line_num][spaces] == " ": spaces += 1 indent = "" - for i in xrange(spaces, nb_spaces): + for dummy in xrange(spaces, nb_spaces): indent += " " for line in lines: if line != "": @@ -547,8 +547,8 @@ # Test if a variable has already been defined def IsAlreadyDefined(self, name): - for list_type, option, located, vars in self.Interface: - for var_type, var_name, var_address, var_initial in vars: + for _list_type, _option, _located, vars in self.Interface: + for _var_type, var_name, _var_address, _var_initial in vars: if name == var_name: return True return False @@ -559,8 +559,8 @@ current_type = None if len(parts) > 0: name = parts.pop(0) - for list_type, option, located, vars in self.Interface: - for var_type, var_name, var_address, var_initial in vars: + for _list_type, _option, _located, vars in self.Interface: + for var_type, var_name, _var_address, _var_initial in vars: if name == var_name: current_type = var_type break @@ -569,7 +569,7 @@ if blocktype is not None: name = parts.pop(0) current_type = None - for var_name, var_type, var_modifier in blocktype["inputs"] + blocktype["outputs"]: + for var_name, var_type, _var_modifier in blocktype["inputs"] + blocktype["outputs"]: if var_name == name: current_type = var_type break @@ -852,7 +852,7 @@ for connection in self.ExtractRelatedConnections(variable.connectionPointOut): self.ConnectionTypes[connection] = "BOOL" else: - for oname, otype, oqualifier in block_infos["outputs"]: + for oname, otype, _oqualifier in block_infos["outputs"]: if output_name == oname: if otype.startswith("ANY"): if otype not in undefined: @@ -867,7 +867,7 @@ for connection in self.ExtractRelatedConnections(variable.connectionPointIn): self.ConnectionTypes[connection] = "BOOL" else: - for iname, itype, iqualifier in block_infos["inputs"]: + for iname, itype, _iqualifier in block_infos["inputs"]: if input_name == iname: connected = self.GetConnectedConnector(variable.connectionPointIn, body) if itype.startswith("ANY"): @@ -1629,7 +1629,7 @@ format(a1=transition_infos["content"], a2=self.Name)) self.Program += transition_infos["content"] self.Program += [("%sEND_TRANSITION\n\n" % self.CurrentIndent, ())] - for [(step_name, step_infos)] in transition_infos["to"]: + for [(step_name, _step_infos)] in transition_infos["to"]: self.ComputeSFCStep(step_name) def GenerateProgram(self, pou): @@ -1648,7 +1648,7 @@ if len(self.Program) == 0: raise PLCGenException(_("No body defined in \"%s\" POU") % self.Name) var_number = 0 - for list_type, option, located, variables in self.Interface: + for list_type, option, _located, variables in self.Interface: variable_type = errorVarTypes.get(list_type, "var_local") program += [(" %s" % list_type, ())] if option is not None: diff -r 14b40afccd69 -r 6198190bc121 PLCOpenEditor.py --- a/PLCOpenEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/PLCOpenEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -317,7 +317,7 @@ message_text = "" header, icon = _("Done"), wx.ICON_INFORMATION if os.path.isdir(os.path.dirname(filepath)): - program, errors, warnings = self.Controler.GenerateProgram(filepath) + _program, errors, warnings = self.Controler.GenerateProgram(filepath) message_text += "".join([_("warning: %s\n") % warning for warning in warnings]) if len(errors) > 0: message_text += "".join([_("error: %s\n") % error for error in errors]) @@ -390,7 +390,7 @@ sys.exit(2) # Extract if help has been requested - for o, a in opts: + for o, _a in opts: if o in ("-h", "--help"): self.PrintUsage() sys.exit() diff -r 14b40afccd69 -r 6198190bc121 ProjectController.py --- a/ProjectController.py Tue Oct 03 16:31:31 2017 +0300 +++ b/ProjectController.py Thu Oct 05 16:38:49 2017 +0300 @@ -71,7 +71,7 @@ def ExtractChildrenTypesFromCatalog(catalog): children_types = [] - for n, d, h, c in catalog: + for n, d, _h, c in catalog: if isinstance(c, ListType): children_types.extend(ExtractChildrenTypesFromCatalog(c)) else: @@ -148,9 +148,9 @@ buildopt = "" try: # Invoke compiler. Output files are listed to stdout, errors to stderr - status, result, err_result = ProcessLogger(None, buildcmd, - no_stdout=True, - no_stderr=True).spin() + _status, result, _err_result = ProcessLogger(None, buildcmd, + no_stdout=True, + no_stderr=True).spin() except Exception: return buildopt @@ -196,7 +196,7 @@ """+"\n".join(['' - for libname, lib in features.libraries])+""" + for libname, _lib in features.libraries])+""" """) if len(features.libraries) > 0 else '') + """ @@ -724,7 +724,7 @@ self.logger.write(_("Generating SoftPLC IEC-61131 ST/IL/SFC code...\n")) # ask PLCOpenEditor controller to write ST/IL/SFC code file - program, errors, warnings = self.GenerateProgram(self._getIECgeneratedcodepath()) + _program, errors, warnings = self.GenerateProgram(self._getIECgeneratedcodepath()) if len(warnings) > 0: self.logger.write_warning(_("Warnings in ST/IL/SFC code generator :\n")) for warning in warnings: @@ -742,7 +742,7 @@ plc_file.close() plc_file = open(self._getIECcodepath(), "r") self.ProgramOffset = 0 - for line in plc_file.xreadlines(): + for dummy in plc_file.xreadlines(): self.ProgramOffset += 1 plc_file.close() plc_file = open(self._getIECcodepath(), "a") @@ -784,7 +784,7 @@ m_result = MATIEC_ERROR_MODEL.match(err_line) if m_result is not None: - first_line, first_column, last_line, last_column, error = m_result.groups() + first_line, _first_column, last_line, _last_column, _error = m_result.groups() first_line, last_line = int(first_line), int(last_line) last_section = None @@ -1023,7 +1023,7 @@ # filter location that are related to code that will be called # in retreive, publish, init, cleanup locstrs = map(lambda x: "_".join(map(str, x)), - [loc for loc, Cfiles, DoCalls in + [loc for loc, _Cfiles, DoCalls in self.LocationCFilesAndCFLAGS if loc and DoCalls]) # Generate main, based on template @@ -1419,7 +1419,7 @@ def SnapshotAndResetDebugValuesBuffers(self): buffers, self.DebugValuesBuffers = (self.DebugValuesBuffers, - [list() for n in xrange(len(self.TracedIECPath))]) + [list() for dummy in xrange(len(self.TracedIECPath))]) ticks, self.DebugTicks = self.DebugTicks, [] return ticks, buffers @@ -1432,7 +1432,7 @@ self.IECdebug_lock.acquire() IECPathsToPop = [] for IECPath, data_tuple in self.IECdebug_datas.iteritems(): - WeakCallableDict, data_log, status, fvalue, buffer_list = data_tuple + WeakCallableDict, _data_log, _status, fvalue, _buffer_list = data_tuple if len(WeakCallableDict) == 0: # Callable Dict is empty. # This variable is not needed anymore! @@ -1480,7 +1480,7 @@ self.DebugTimer.start() def GetDebugIECVariableType(self, IECPath): - Idx, IEC_Type = self._IECPathToIdx.get(IECPath, (None, None)) + _Idx, IEC_Type = self._IECPathToIdx.get(IECPath, (None, None)) return IEC_Type def SubscribeDebugIECVariable(self, IECPath, callableobj, buffer_list=False): @@ -1570,7 +1570,7 @@ def CallWeakcallables(self, IECPath, function_name, *cargs): data_tuple = self.IECdebug_datas.get(IECPath, None) if data_tuple is not None: - WeakCallableDict, data_log, status, fvalue, buffer_list = data_tuple + WeakCallableDict, _data_log, _status, _fvalue, buffer_list = data_tuple # data_log.append((debug_tick, value)) for weakcallable, buffer_list in WeakCallableDict.iteritems(): function = getattr(weakcallable, function_name, None) diff -r 14b40afccd69 -r 6198190bc121 canfestival/NetworkEditor.py --- a/canfestival/NetworkEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/canfestival/NetworkEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -96,7 +96,7 @@ if profile not in ("None", "DS-301"): other_profile_text = _("%s Profile") % profile add_menu.append((wx.ITEM_SEPARATOR, None)) - for text, indexes in self.Manager.GetCurrentSpecificMenu(): + for text, _indexes in self.Manager.GetCurrentSpecificMenu(): add_menu.append((wx.ITEM_NORMAL, (text, wx.NewId(), '', self.GetProfileCallBack(text)))) else: other_profile_text = _('Other Profile') diff -r 14b40afccd69 -r 6198190bc121 canfestival/SlaveEditor.py --- a/canfestival/SlaveEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/canfestival/SlaveEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -71,7 +71,7 @@ if profile not in ("None", "DS-301"): other_profile_text = _("%s Profile") % profile add_menu.append((wx.ITEM_SEPARATOR, None)) - for text, indexes in self.Manager.GetCurrentSpecificMenu(): + for text, _indexes in self.Manager.GetCurrentSpecificMenu(): add_menu.append((wx.ITEM_NORMAL, (text, wx.NewId(), '', self.GetProfileCallBack(text)))) else: other_profile_text = _('Other Profile') diff -r 14b40afccd69 -r 6198190bc121 canfestival/canfestival.py --- a/canfestival/canfestival.py Tue Oct 03 16:31:31 2017 +0300 +++ b/canfestival/canfestival.py Thu Oct 05 16:38:49 2017 +0300 @@ -134,7 +134,7 @@ dialog.Type.Enable(False) dialog.GenSYNC.Enable(False) if dialog.ShowModal() == wx.ID_OK: - name, id, nodetype, description = dialog.GetValues() + name, id, _nodetype, description = dialog.GetValues() profile, filepath = dialog.GetProfile() NMT = dialog.GetNMTManagement() options = dialog.GetOptions() diff -r 14b40afccd69 -r 6198190bc121 canfestival/config_utils.py --- a/canfestival/config_utils.py Tue Oct 03 16:31:31 2017 +0300 +++ b/canfestival/config_utils.py Thu Oct 05 16:38:49 2017 +0300 @@ -149,7 +149,7 @@ # Disable Mapping dcfdata += [LE_to_BE(idx + 0x200, 2) + LE_to_BE(0x00, 1) + LE_to_BE(0x01, 4) + LE_to_BE(0x00, 1)] # Map Variables - for subindex, (name, loc_infos) in enumerate(pdomapping): + for subindex, (_name, loc_infos) in enumerate(pdomapping): value = (loc_infos["index"] << 16) + (loc_infos["subindex"] << 8) + loc_infos["size"] dcfdata += [LE_to_BE(idx + 0x200, 2) + LE_to_BE(subindex + 1, 1) + LE_to_BE(0x04, 4) + LE_to_BE(value, 4)] # Re-enable Mapping diff -r 14b40afccd69 -r 6198190bc121 connectors/PYRO/__init__.py --- a/connectors/PYRO/__init__.py Tue Oct 03 16:31:31 2017 +0300 +++ b/connectors/PYRO/__init__.py Thu Oct 05 16:38:49 2017 +0300 @@ -161,7 +161,7 @@ object is recreated meanwhile, so we must not keep ref to it here """ - current_status, log_count = confnodesroot._connector.GetPyroProxy().GetPLCstatus() + current_status, _log_count = confnodesroot._connector.GetPyroProxy().GetPLCstatus() if current_status == "Dirty": # Some bad libs with static symbols may polute PLC # ask runtime to suicide and come back again diff -r 14b40afccd69 -r 6198190bc121 controls/CustomStyledTextCtrl.py --- a/controls/CustomStyledTextCtrl.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/CustomStyledTextCtrl.py Thu Oct 05 16:38:49 2017 +0300 @@ -95,7 +95,7 @@ def OnMotion(self, event): if wx.Platform == '__WXMSW__': if not event.Dragging(): - x, y = event.GetPosition() + x, _y = event.GetPosition() margin_width = reduce( lambda x, y: x + y, [self.GetMarginWidth(i) diff -r 14b40afccd69 -r 6198190bc121 controls/CustomTable.py --- a/controls/CustomTable.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/CustomTable.py Thu Oct 05 16:38:49 2017 +0300 @@ -192,7 +192,7 @@ if highlight_type is None: self.Highlights = {} else: - for row, row_highlights in self.Highlights.iteritems(): + for _row, row_highlights in self.Highlights.iteritems(): row_items = row_highlights.items() for col, col_highlights in row_items: if highlight_type in col_highlights: diff -r 14b40afccd69 -r 6198190bc121 controls/CustomToolTip.py --- a/controls/CustomToolTip.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/CustomToolTip.py Thu Oct 05 16:38:49 2017 +0300 @@ -184,7 +184,7 @@ line_offset = 0 for line in self.Tip: dc.DrawText(line, 2, line_offset + 2) - line_width, line_height = dc.GetTextExtent(line) + _line_width, line_height = dc.GetTextExtent(line) line_offset += line_height dc.EndDrawing() diff -r 14b40afccd69 -r 6198190bc121 controls/CustomTree.py --- a/controls/CustomTree.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/CustomTree.py Thu Oct 05 16:38:49 2017 +0300 @@ -114,7 +114,7 @@ def OnLeftUp(self, event): if self.Enabled: pos = event.GetPosition() - item, flags = self.HitTest(pos) + _item, flags = self.HitTest(pos) bitmap_rect = self.GetBitmapRect() if ((bitmap_rect.InsideXY(pos.x, pos.y) or diff -r 14b40afccd69 -r 6198190bc121 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -193,7 +193,7 @@ merge_type, force=True) else: - width, height = self.ParentControl.GetSize() + _width, height = self.ParentControl.GetSize() # Get Before which Viewer the variable has to be moved or added # according to the position of mouse in Viewer. @@ -610,7 +610,7 @@ """ # Get mouse position, graph Y coordinate is inverted in matplotlib # comparing to wx - width, height = self.GetSize() + _width, height = self.GetSize() x, y = event.x, height - event.y # Return immediately if mouse is over a button @@ -679,7 +679,7 @@ """ # If a drag'n drop is in progress, stop it if self.ParentWindow.IsDragging(): - width, height = self.GetSize() + _width, height = self.GetSize() xw, yw = self.GetPosition() item = self.ParentWindow.DraggingAxesPanel.ItemsDict.values()[0] # Give mouse position in wx coordinate of parent @@ -692,7 +692,7 @@ self.CanvasStartSize = None # Handle button under mouse if it exist - width, height = self.GetSize() + _width, height = self.GetSize() self.HandleButton(event.x, height - event.y) def OnCanvasMotion(self, event): @@ -700,7 +700,7 @@ Function called when a button of mouse is moved over Viewer @param event: Mouse event """ - width, height = self.GetSize() + _width, height = self.GetSize() # If a drag'n drop is in progress, move canvas dragged if self.ParentWindow.IsDragging(): @@ -712,7 +712,7 @@ # If a Viewer resize is in progress, change Viewer size elif event.button == 1 and self.CanvasStartSize is not None: - width, height = self.GetSize() + _width, height = self.GetSize() self.SetCanvasHeight( self.CanvasStartSize + height - event.y - self.MouseStartPos.y) @@ -926,7 +926,7 @@ @param x: X coordinate of mouse pointer @param y: Y coordinate of mouse pointer """ - width, height = self.GetSize() + _width, height = self.GetSize() # Mouse is over Viewer figure and graph is not 3D bbox = self.GetAxesBoundingBox() @@ -1070,7 +1070,7 @@ verticalalignment='top')) # Refresh position of labels according to Viewer size - width, height = self.GetSize() + _width, height = self.GetSize() self.RefreshLabelsPosition(height) def RefreshLabelsPosition(self, height): @@ -1209,9 +1209,9 @@ # Get X and Y coordinates for cursor if cursor tick is defined if self.CursorTick is not None: - x_cursor, x_forced = items[0].GetValue( + x_cursor, _x_forced = items[0].GetValue( self.CursorTick, raw=True) - y_cursor, y_forced = items[1].GetValue( + y_cursor, _y_forced = items[1].GetValue( self.CursorTick, raw=True) # Get common data length so that each value has an x and y @@ -1305,7 +1305,7 @@ start_tick <= self.CursorTick <= end_tick: # Get Z coordinate for cursor - z_cursor, z_forced = items[2].GetValue( + z_cursor, _z_forced = items[2].GetValue( self.CursorTick, raw=True) # Add 3 lines parallel to x, y and z axis to display diff -r 14b40afccd69 -r 6198190bc121 controls/DebugVariablePanel/DebugVariablePanel.py --- a/controls/DebugVariablePanel/DebugVariablePanel.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariablePanel.py Thu Oct 05 16:38:49 2017 +0300 @@ -68,7 +68,7 @@ def NextTick(variables): next_tick = None - for item, data in variables: + for _item, data in variables: if len(data) == 0: continue @@ -232,7 +232,7 @@ self.CanvasRange.Clear() default_range_idx = 0 - for idx, (text, value) in enumerate(RANGE_VALUES): + for idx, (text, _value) in enumerate(RANGE_VALUES): self.CanvasRange.Append(text) if text == "1s": default_range_idx = idx diff -r 14b40afccd69 -r 6198190bc121 controls/DebugVariablePanel/DebugVariableTextViewer.py --- a/controls/DebugVariablePanel/DebugVariableTextViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -101,7 +101,7 @@ # Get Before which Viewer the variable has to be moved or added # according to the position of mouse in Viewer. - width, height = self.ParentControl.GetSize() + _width, height = self.ParentControl.GetSize() target_idx = self.ParentControl.GetIndex() if y > height / 2: target_idx += 1 @@ -237,7 +237,7 @@ item = self.ItemsDict.values()[0] # Calculate item path bounding box - width, height = self.GetSize() + _width, height = self.GetSize() item_path = item.GetVariable( self.ParentWindow.GetVariableNameMask()) w, h = self.GetTextExtent(item_path) diff -r 14b40afccd69 -r 6198190bc121 controls/DebugVariablePanel/DebugVariableViewer.py --- a/controls/DebugVariablePanel/DebugVariableViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -248,7 +248,7 @@ Function that refresh buttons position in Viewer """ # Get Viewer size - width, height = self.GetSize() + width, _height = self.GetSize() # Buttons are align right so we calculate buttons positions in # reverse order @@ -262,7 +262,7 @@ if button.IsEnabled(): # Update button position according to button width and offset # on x coordinate - w, h = button.GetSize() + w, _h = button.GetSize() button.SetPosition(width - 5 - w - x_offset, 5) # Update offset on x coordinate x_offset += w + 2 @@ -372,7 +372,7 @@ @param y: Y coordinate of mouse pointer """ # Get Viewer size - width, height = self.GetSize() + _width, height = self.GetSize() # Mouse is in the first half of Viewer if y < height / 2: diff -r 14b40afccd69 -r 6198190bc121 controls/LibraryPanel.py --- a/controls/LibraryPanel.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/LibraryPanel.py Thu Oct 05 16:38:49 2017 +0300 @@ -245,7 +245,7 @@ "type": BLOCK, "block_type": blocktype["type"], "inputs": tuple([type - for name, type, modifier + for _name, type, _modifier in blocktype["inputs"]]), "extension": (len(blocktype["inputs"]) if blocktype["extensible"] else None), @@ -390,7 +390,7 @@ # Get current selected item (for next and previous mode) item = self.Tree.GetSelection() if not item.IsOk() or mode == "first": - item, item_cookie = self.Tree.GetFirstChild(root) + item, _item_cookie = self.Tree.GetFirstChild(root) selected = None else: selected = item diff -r 14b40afccd69 -r 6198190bc121 controls/LogViewer.py --- a/controls/LogViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/LogViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -69,7 +69,7 @@ return wx.Rect(0, width, width, height - 2 * width) def GetThumbRect(self): - width, height = self.GetClientSize() + width, _height = self.GetClientSize() range_rect = self.GetRangeRect() thumb_size = range_rect.height * THUMB_SIZE_RATIO thumb_range = range_rect.height - thumb_size @@ -118,7 +118,7 @@ def OnMotion(self, event): if event.Dragging() and self.ThumbScrollingStartPos is not None: - posx, posy = event.GetPosition() + _posx, posy = event.GetPosition() range_rect = self.GetRangeRect() thumb_size = range_rect.height * THUMB_SIZE_RATIO thumb_range = range_rect.height - thumb_size @@ -269,7 +269,7 @@ dc.DrawBitmap(self.LevelBitmap, 10 + sw, offset + (MESSAGE_INFO_SIZE - bh) / 2) text = self.Message.replace("\n", " ") - mw, mh = dc.GetTextExtent(text) + _mw, mh = dc.GetTextExtent(text) dc.DrawText(text, 15 + sw + bw, offset + (MESSAGE_INFO_SIZE - mh) / 2) def GetHeight(self, draw_date): @@ -405,7 +405,7 @@ if self.LogSource is not None: answer = self.LogSource.GetLogMessage(level, msgidx) if answer is not None: - msg, tick, tv_sec, tv_nsec = answer + msg, _tick, tv_sec, tv_nsec = answer return LogMessage(tv_sec, tv_nsec, level, self.LevelIcons[level], msg) return None @@ -486,12 +486,12 @@ msgidx -= 1 if len(self.LogMessages) > 0: message = self.LogMessages[0] - for idx, msg in self.OldestMessages: + for _idx, msg in self.OldestMessages: if msg is not None and msg > message: message = msg while message is not None: level = message.Level - oldest_msgidx, oldest_message = self.OldestMessages[level] + oldest_msgidx, _oldest_message = self.OldestMessages[level] if oldest_msgidx > 0: message = self.GetLogMessageFromSource(oldest_msgidx - 1, level) if message is not None: @@ -518,7 +518,7 @@ self.CurrentMessage = self.LogMessages.index(current_message) if message_idx == 0 and self.FilterLogMessage(message, timestamp): return message, 0 - for idx, msg in self.OldestMessages: + for _idx, msg in self.OldestMessages: if msg is not None and (message is None or msg > message): message = msg return None, None @@ -562,7 +562,7 @@ def IsPLCLogEmpty(self): empty = True - for level, prev in zip(xrange(LogLevelsCount), self.previous_log_count): + for _level, prev in zip(xrange(LogLevelsCount), self.previous_log_count): if prev is not None: empty = False break @@ -579,7 +579,7 @@ if message_idx is None: message_idx = self.CurrentMessage if message_idx is not None: - width, height = self.MessagePanel.GetClientSize() + _width, height = self.MessagePanel.GetClientSize() offset = 5 message = self.LogMessages[message_idx] draw_date = True @@ -609,7 +609,7 @@ def ScrollMessagePanelByPage(self, page): if self.CurrentMessage is not None: - width, height = self.MessagePanel.GetClientSize() + _width, height = self.MessagePanel.GetClientSize() message_per_page = max(1, (height - DATE_INFO_SIZE) / MESSAGE_INFO_SIZE - 1) self.ScrollMessagePanel(page * message_per_page) @@ -673,7 +673,7 @@ def GetMessageByScreenPos(self, posx, posy): if self.CurrentMessage is not None: - width, height = self.MessagePanel.GetClientSize() + _width, height = self.MessagePanel.GetClientSize() message_idx = self.CurrentMessage message = self.LogMessages[message_idx] draw_date = True @@ -766,15 +766,15 @@ event.Skip() def OnMessagePanelResize(self, event): - width, height = self.MessagePanel.GetClientSize() + width, _height = self.MessagePanel.GetClientSize() offset = 2 for button in self.LeftButtons: button.SetPosition(offset, 2) - w, h = button.GetSize() + w, _h = button.GetSize() offset += w + 2 offset = width - 2 for button in self.RightButtons: - w, h = button.GetSize() + w, _h = button.GetSize() button.SetPosition(offset - w, 2) offset -= w + 2 if self.IsMessagePanelBottom(): diff -r 14b40afccd69 -r 6198190bc121 controls/PouInstanceVariablesPanel.py --- a/controls/PouInstanceVariablesPanel.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/PouInstanceVariablesPanel.py Thu Oct 05 16:38:49 2017 +0300 @@ -66,14 +66,14 @@ height = CT.CustomTreeCtrl.GetLineHeight(self, item) rightimages = item.GetRightImages() if len(rightimages) > 0: - r_image_w, r_image_h = self._imageListRight.GetSize(rightimages[0]) + _r_image_w, r_image_h = self._imageListRight.GetSize(rightimages[0]) return max(height, r_image_h + 8) return height def GetItemRightImagesBBox(self, item): rightimages = item.GetRightImages() if len(rightimages) > 0: - w, h = self.GetClientSize() + w, _h = self.GetClientSize() total_h = self.GetLineHeight(item) r_image_w, r_image_h = self._imageListRight.GetSize(rightimages[0]) @@ -108,7 +108,7 @@ rightimages = item.GetRightImages() if len(rightimages) > 0: images_bbx = self.GetItemRightImagesBBox(item) - r_image_w, r_image_h = self._imageListRight.GetSize(rightimages[0]) + r_image_w, _r_image_h = self._imageListRight.GetSize(rightimages[0]) dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.SetPen(wx.TRANSPARENT_PEN) diff -r 14b40afccd69 -r 6198190bc121 controls/SearchResultPanel.py --- a/controls/SearchResultPanel.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/SearchResultPanel.py Thu Oct 05 16:38:49 2017 +0300 @@ -333,7 +333,7 @@ else: search_results = self.SearchResults.get(data, []) self.ParentWindow.ClearHighlights(SEARCH_RESULT_HIGHLIGHT) - for infos, start, end, text in search_results: + for infos, start, end, _text in search_results: self.ParentWindow.ShowSearchResult(infos, start, end) def OnSearchResultsTreeItemActivated(self, event): diff -r 14b40afccd69 -r 6198190bc121 controls/VariablePanel.py --- a/controls/VariablePanel.py Tue Oct 03 16:31:31 2017 +0300 +++ b/controls/VariablePanel.py Thu Oct 05 16:38:49 2017 +0300 @@ -875,7 +875,7 @@ def BuildProjectTypesMenu(self, type_menu, classtype): # build a submenu containing function block types bodytype = self.Controler.GetEditedElementBodyType(self.TagName) - pouname, poutype = self.Controler.GetEditedElementType(self.TagName) + _pouname, poutype = self.Controler.GetEditedElementType(self.TagName) if classtype in ["Input", "Output", "InOut", "External", "Global"] or \ poutype != "function" and bodytype in ["ST", "IL"]: functionblock_menu = wx.Menu(title='') diff -r 14b40afccd69 -r 6198190bc121 dialogs/BrowseLocationsDialog.py --- a/dialogs/BrowseLocationsDialog.py Tue Oct 03 16:31:31 2017 +0300 +++ b/dialogs/BrowseLocationsDialog.py Thu Oct 05 16:38:49 2017 +0300 @@ -147,7 +147,7 @@ self.LocationsTree.SetImageList(self.TreeImageList) # Set a options for the choice - for option, filter in GetDirFilterChoiceOptions(): + for option, _filter in GetDirFilterChoiceOptions(): self.DirFilterChoice.Append(_(option)) self.DirFilterChoice.SetStringSelection(_("All")) for option in GetTypeFilterChoiceOptions(): diff -r 14b40afccd69 -r 6198190bc121 dialogs/FBDVariableDialog.py --- a/dialogs/FBDVariableDialog.py Tue Oct 03 16:31:31 2017 +0300 +++ b/dialogs/FBDVariableDialog.py Thu Oct 05 16:38:49 2017 +0300 @@ -146,7 +146,7 @@ # Refresh names in name list box by selecting variables in POU variables # list that can be applied to variable class self.VariableName.Clear() - for name, (var_type, value_type) in self.VariableList.iteritems(): + for name, (var_type, _value_type) in self.VariableList.iteritems(): if var_type != "Input" or var_class == INPUT: self.VariableName.Append(name) diff -r 14b40afccd69 -r 6198190bc121 dialogs/SFCTransitionDialog.py --- a/dialogs/SFCTransitionDialog.py Tue Oct 03 16:31:31 2017 +0300 +++ b/dialogs/SFCTransitionDialog.py Thu Oct 05 16:38:49 2017 +0300 @@ -196,7 +196,7 @@ @param event: wx.RadioButtonEvent """ # Refresh sensibility of control associated to transition types - for type, (radio, control) in self.TypeRadioButtons.iteritems(): + for _type, (radio, control) in self.TypeRadioButtons.iteritems(): if control is not None: control.Enable(radio.GetValue()) diff -r 14b40afccd69 -r 6198190bc121 dialogs/SearchInProjectDialog.py --- a/dialogs/SearchInProjectDialog.py Tue Oct 03 16:31:31 2017 +0300 +++ b/dialogs/SearchInProjectDialog.py Thu Oct 05 16:38:49 2017 +0300 @@ -109,7 +109,7 @@ self.SetSizer(main_sizer) - for name, label in GetElementsChoices(): + for _name, label in GetElementsChoices(): self.ElementsList.Append(_(label)) self.Fit() @@ -154,7 +154,7 @@ infos["filter"] = "all" elif self.OnlyElements.GetValue(): infos["filter"] = [] - for index, (name, label) in enumerate(GetElementsChoices()): + for index, (name, _label) in enumerate(GetElementsChoices()): if self.ElementsList.IsChecked(index): infos["filter"].append(name) diff -r 14b40afccd69 -r 6198190bc121 editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/CodeFileEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -508,7 +508,7 @@ self.SearchResults = [ (start, end, SEARCH_RESULT_HIGHLIGHT) - for start, end, text in + for start, end, _text in TestTextElement(self.GetText(), search_params)] self.CurrentFindHighlight = None diff -r 14b40afccd69 -r 6198190bc121 editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/ConfTreeNodeEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -408,7 +408,7 @@ if element_infos["use"] == "optional": combobox.Append("") if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], types.TupleType): - for choice, xsdclass in element_infos["type"]: + for choice, _xsdclass in element_infos["type"]: combobox.Append(choice) name = element_infos["name"] value = element_infos["value"] diff -r 14b40afccd69 -r 6198190bc121 editors/DataTypeEditor.py --- a/editors/DataTypeEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/DataTypeEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -237,7 +237,7 @@ subrange_panel_sizer.AddWindow(self.SubrangeMinimum, 1, border=5, flag=wx.GROW | wx.ALL) - for i in xrange(2): + for dummy in xrange(2): subrange_panel_sizer.AddWindow(wx.Size(0, 0), 1) subrange_maximum_label = wx.StaticText(self.SubrangePanel, diff -r 14b40afccd69 -r 6198190bc121 editors/DebugViewer.py --- a/editors/DebugViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/DebugViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -128,7 +128,7 @@ @param inhibit: Inhibit flag """ # Inhibit every data consumers in list - for consumer, iec_path in self.DataConsumers.iteritems(): + for consumer, _iec_path in self.DataConsumers.iteritems(): consumer.Inhibit(inhibit) # Save inhibit flag diff -r 14b40afccd69 -r 6198190bc121 editors/FileManagementPanel.py --- a/editors/FileManagementPanel.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/FileManagementPanel.py Thu Oct 05 16:38:49 2017 +0300 @@ -148,7 +148,7 @@ def OnDeleteButton(self, event): filepath = self.ManagedDir.GetPath() if os.path.isfile(filepath): - folder, filename = os.path.split(filepath) + _folder, filename = os.path.split(filepath) dialog = wx.MessageDialog(self, _("Do you really want to delete the file '%s'?") % filename, @@ -171,9 +171,9 @@ def CopyFile(self, src, dst): if os.path.isfile(src): - src_folder, src_filename = os.path.split(src) + _src_folder, src_filename = os.path.split(src) if os.path.isfile(dst): - dst_folder, dst_filename = os.path.split(dst) + dst_folder, _dst_filename = os.path.split(dst) else: dst_folder = dst diff -r 14b40afccd69 -r 6198190bc121 editors/LDViewer.py --- a/editors/LDViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/LDViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -45,7 +45,7 @@ if "input" in connectors: input_connectors = [connectors["input"]] for connector in input_connectors: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): next = wire.EndConnected.GetParentBlock() if not isinstance(next, LD_PowerRail) and next not in block_list: block_list.append(next) @@ -116,7 +116,7 @@ if "input" in connectors: input_connectors = [connectors["input"]] for connector in input_connectors: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): next = wire.EndConnected.GetParentBlock() if isinstance(next, LD_PowerRail) and next.GetType() == LEFTRAIL or next in stop_list: # for remove in element_tree[element]["children"]: @@ -224,7 +224,7 @@ element_connectors = element.GetConnectors() self.Rungs[rungs[0]].SelectElement(element) for connector in element_connectors["inputs"]: - for wire, num in connector.GetWires(): + for wire, _num in connector.GetWires(): self.Rungs[rungs[0]].SelectElement(wire) wx.CallAfter(self.RefreshPosition, element) elif instance["type"] in ["contact", "coil"]: @@ -242,7 +242,7 @@ element = self.FindElementById(instance["id"]) element_connectors = element.GetConnectors() self.Rungs[rungs[0]].SelectElement(element) - for wire, num in element_connectors["inputs"][0].GetWires(): + for wire, _num in element_connectors["inputs"][0].GetWires(): self.Rungs[rungs[0]].SelectElement(wire) wx.CallAfter(self.RefreshPosition, element) elif instance["type"] == "comment": @@ -696,7 +696,7 @@ block_infos = {"lefts": [], "rights": []} block_infos.update(connectors) for connector in block_infos["inputs"]: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): found = False for infos in blocks_infos: if wire.EndConnected in infos["outputs"]: @@ -713,7 +713,7 @@ index = left_elements.index(wire.EndConnected) left_index[index] = max(left_index[index], wire.EndConnected.GetWireIndex(wire)) for connector in block_infos["outputs"]: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): found = False for infos in blocks_infos: if wire.StartConnected in infos["inputs"]: @@ -862,7 +862,7 @@ for i, left_element in enumerate(left_elements): for j, right_element in enumerate(right_elements): exist = False - for wire, handle in right_element.GetWires(): + for wire, _handle in right_element.GetWires(): exist |= wire.EndConnected == left_element if not exist: new_wire = Wire(self) @@ -914,8 +914,8 @@ rung = self.Rungs[rungindex] old_bbox = rung.GetBoundingBox() connectors = contact.GetConnectors() - input_wires = [wire for wire, handle in connectors["inputs"][0].GetWires()] - output_wires = [wire for wire, handle in connectors["outputs"][0].GetWires()] + input_wires = [wire for wire, _handle in connectors["inputs"][0].GetWires()] + output_wires = [wire for wire, _handle in connectors["outputs"][0].GetWires()] left_elements = [(wire.EndConnected, wire.EndConnected.GetWireIndex(wire)) for wire in input_wires] right_elements = [(wire.StartConnected, wire.StartConnected.GetWireIndex(wire)) for wire in output_wires] for wire in input_wires: @@ -934,7 +934,7 @@ for left_element, left_index in left_elements: for right_element, right_index in right_elements: wire_removed = [] - for wire, handle in right_element.GetWires(): + for wire, _handle in right_element.GetWires(): if wire.EndConnected == left_element: wire_removed.append(wire) elif isinstance(wire.EndConnected.GetParentBlock(), LD_PowerRail) and powerrail: @@ -971,7 +971,7 @@ def RecursiveDeletion(self, element, rung): connectors = element.GetConnectors() - input_wires = [wire for wire, handle in connectors["inputs"][0].GetWires()] + input_wires = [wire for wire, _handle in connectors["inputs"][0].GetWires()] left_elements = [wire.EndConnected for wire in input_wires] rung.SelectElement(element) element.Clean() @@ -1001,7 +1001,7 @@ nbcoils += 1 if nbcoils > 1: connectors = coil.GetConnectors() - output_wires = [wire for wire, handle in connectors["outputs"][0].GetWires()] + output_wires = [wire for wire, _handle in connectors["outputs"][0].GetWires()] right_elements = [wire.StartConnected for wire in output_wires] for wire in output_wires: wire.Clean() @@ -1016,7 +1016,7 @@ right_block.DeleteConnector(index) powerrail_connectors = right_block.GetConnectors() for connector in powerrail_connectors["inputs"]: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): block = wire.EndConnected.GetParentBlock() endpoint = wire.EndConnected.GetPosition(False) startpoint = connector.GetPosition(False) @@ -1081,7 +1081,7 @@ else: connectors = left_block.GetConnectors() for connector in connectors["outputs"]: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): self.RefreshPosition(wire.StartConnected.GetParentBlock()) for right_element in right_elements: self.RefreshPosition(right_element.GetParentBlock()) @@ -1107,7 +1107,7 @@ onlyone = [] for connector in connectors["inputs"]: onlyone.append(len(connector.GetWires()) == 1) - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): onlyone[-1] &= len(wire.EndConnected.GetWires()) == 1 leftblock = wire.EndConnected.GetParentBlock() pos = leftblock.GetPosition() @@ -1128,7 +1128,7 @@ # Extract blocks connected to inputs blocks = [] for i, connector in enumerate(connectors["inputs"]): - for j, (wire, handle) in enumerate(connector.GetWires()): + for j, (wire, _handle) in enumerate(connector.GetWires()): blocks.append(wire.EndConnected.GetParentBlock()) for i, connector in enumerate(connectors["inputs"]): @@ -1138,7 +1138,7 @@ start_offset = 0 if not onlyone[i]: middlepoint = maxx + LD_WIRE_SIZE - for j, (wire, handle) in enumerate(connector.GetWires()): + for j, (wire, _handle) in enumerate(connector.GetWires()): block = wire.EndConnected.GetParentBlock() if isinstance(element, LD_PowerRail): pos = block.GetPosition() @@ -1182,7 +1182,7 @@ element.RefreshModel(False) if recursive: for connector in connectors["outputs"]: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): self.RefreshPosition(wire.StartConnected.GetParentBlock()) def RefreshRungs(self, movey, fromidx): diff -r 14b40afccd69 -r 6198190bc121 editors/ResourceEditor.py --- a/editors/ResourceEditor.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/ResourceEditor.py Thu Oct 05 16:38:49 2017 +0300 @@ -211,7 +211,7 @@ if highlight_type is None: self.Highlights = {} else: - for row, row_highlights in self.Highlights.iteritems(): + for _row, row_highlights in self.Highlights.iteritems(): row_items = row_highlights.items() for col, col_highlights in row_items: if highlight_type in col_highlights: diff -r 14b40afccd69 -r 6198190bc121 editors/SFCViewer.py --- a/editors/SFCViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/SFCViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -579,7 +579,7 @@ self.AddBlock(divergence) self.Controler.AddEditedElementDivergence(self.TagName, id, value["type"]) self.RefreshDivergenceModel(divergence) - for index, connector in enumerate(divergence_connectors["outputs"]): + for _index, connector in enumerate(divergence_connectors["outputs"]): if next: wire = self.ConnectConnectors(next, connector) pos = connector.GetPosition(False) @@ -593,7 +593,7 @@ else: transition = self.CreateTransition(connector) transition_connectors = transition.GetConnectors() - step = self.CreateStep("Step", transition_connectors["output"]) + _step = self.CreateStep("Step", transition_connectors["output"]) elif value["type"] == SIMULTANEOUS_DIVERGENCE: if self.SelectedElement in self.Wires and isinstance(self.SelectedElement.EndConnected.GetParentBlock(), SFC_Transition): self.SelectedElement.SetSelectedSegment(None) @@ -637,7 +637,7 @@ self.AddBlock(divergence) self.Controler.AddEditedElementDivergence(self.TagName, id, value["type"]) self.RefreshDivergenceModel(divergence) - for index, connector in enumerate(divergence_connectors["outputs"]): + for _index, connector in enumerate(divergence_connectors["outputs"]): if next: wire = self.ConnectConnectors(next, connector) pos = connector.GetPosition(False) @@ -649,7 +649,7 @@ next_block.RefreshModel() next = None else: - step = self.CreateStep("Step", connector) + _step = self.CreateStep("Step", connector) elif isinstance(self.SelectedElement, Graphic_Group) and len(self.SelectedElement.GetElements()) > 1: next = None for element in self.SelectedElement.GetElements(): @@ -746,7 +746,7 @@ previous = transition_connectors["output"] else: previous = divergence_connectors["outputs"][-1] - step = self.CreateStep("Step", previous) + _step = self.CreateStep("Step", previous) self.RefreshBuffer() self.RefreshScrollBars() self.Refresh(False) diff -r 14b40afccd69 -r 6198190bc121 editors/TextViewer.py --- a/editors/TextViewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/TextViewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -286,7 +286,7 @@ else: event.SetDragText(blockname+"(\n "+hint+")") elif values[1] == "location": - pou_name, pou_type = self.Controler.GetEditedElementType(self.TagName, self.Debug) + _pou_name, pou_type = self.Controler.GetEditedElementType(self.TagName, self.Debug) if len(values) > 2 and pou_type == "program": var_name = values[3] dlg = wx.TextEntryDialog( @@ -339,7 +339,7 @@ else: event.SetDragText("") elif values[1] == "NamedConstant": - pou_name, pou_type = self.Controler.GetEditedElementType(self.TagName, self.Debug) + _pou_name, pou_type = self.Controler.GetEditedElementType(self.TagName, self.Debug) if pou_type == "program": initval = values[0] var_name = values[3] @@ -497,7 +497,7 @@ for blocktype in category["list"]: blockname = blocktype["name"].upper() if blocktype["type"] == "function" and blockname not in self.Keywords and blockname not in self.Variables.keys(): - interface = dict([(name, {}) for name, type, modifier in blocktype["inputs"] + blocktype["outputs"] if name != '']) + interface = dict([(name, {}) for name, _type, _modifier in blocktype["inputs"] + blocktype["outputs"] if name != '']) for param in ["EN", "ENO"]: if param not in interface: interface[param] = {} @@ -517,7 +517,7 @@ for variable in self.Controler.GetEditedElementInterfaceVars( self.TagName, True, self.Debug)]) if self.Controler.GetEditedElementType(self.TagName, self.Debug)[1] == "function" or words[0] == "T" and self.TextSyntax == "IL": - return_type, (var_tree, var_dimension) = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, True, self.Debug) + return_type, (var_tree, _var_dimension) = self.Controler.GetEditedElementInterfaceReturnType(self.TagName, True, self.Debug) if return_type is not None: self.Variables[words[-1].upper()] = self.GenerateVariableTree(var_tree) else: @@ -525,7 +525,7 @@ def GenerateVariableTree(self, list): tree = {} - for var_name, var_type, (var_tree, var_dimension) in list: + for var_name, _var_type, (var_tree, _var_dimension) in list: tree[var_name.upper()] = self.GenerateVariableTree(var_tree) return tree @@ -818,7 +818,7 @@ self.SearchParams = search_params self.SearchResults = [ (infos[1:], start, end, SEARCH_RESULT_HIGHLIGHT) - for infos, start, end, text in + for infos, start, end, _text in self.Search(search_params)] self.CurrentFindHighlight = None diff -r 14b40afccd69 -r 6198190bc121 editors/Viewer.py --- a/editors/Viewer.py Tue Oct 03 16:31:31 2017 +0300 +++ b/editors/Viewer.py Thu Oct 05 16:38:49 2017 +0300 @@ -487,7 +487,7 @@ def GetRedrawRect(self): x, y = self.Parent.CalcUnscrolledPosition(self.x_offset, self.y_offset) dc = self.Parent.GetLogicalDC() - ipw, iph = dc.GetTextExtent(self.GetInstanceName()) + ipw, _iph = dc.GetTextExtent(self.GetInstanceName()) vw, vh = 0, 0 for value in self.VALUE_TRANSLATION.itervalues(): w, h = dc.GetTextExtent(" (%s)" % value) @@ -505,7 +505,7 @@ text += " (" dc.DrawText(text, x, y) - tw, th = dc.GetTextExtent(text) + tw, _th = dc.GetTextExtent(text) if self.ActionState is not None: text = self.VALUE_TRANSLATION[self.ActionState] @@ -548,7 +548,7 @@ # Add Block Pin Menu items to the given menu def AddBlockPinMenuItems(self, menu, connector): [ID_NO_MODIFIER, ID_NEGATED, ID_RISING_EDGE, - ID_FALLING_EDGE] = [wx.NewId() for i in xrange(4)] + ID_FALLING_EDGE] = [wx.NewId() for dummy in xrange(4)] # Create menu items self.AddMenuItems(menu, [ @@ -575,7 +575,7 @@ [ ID_ALIGN_LEFT, ID_ALIGN_CENTER, ID_ALIGN_RIGHT, ID_ALIGN_TOP, ID_ALIGN_MIDDLE, ID_ALIGN_BOTTOM, - ] = [wx.NewId() for i in xrange(6)] + ] = [wx.NewId() for dummy in xrange(6)] # Create menu items self.AddMenuItems(menu, [ @@ -590,7 +590,7 @@ # Add Wire Menu items to the given menu def AddWireMenuItems(self, menu, delete=False, replace=False): [ID_ADD_SEGMENT, ID_DELETE_SEGMENT, ID_REPLACE_WIRE, - ] = [wx.NewId() for i in xrange(3)] + ] = [wx.NewId() for dummy in xrange(3)] # Create menu items self.AddMenuItems(menu, [ @@ -603,7 +603,7 @@ # Add Divergence Menu items to the given menu def AddDivergenceMenuItems(self, menu, delete=False): - [ID_ADD_BRANCH, ID_DELETE_BRANCH] = [wx.NewId() for i in xrange(2)] + [ID_ADD_BRANCH, ID_DELETE_BRANCH] = [wx.NewId() for dummy in xrange(2)] # Create menu items self.AddMenuItems(menu, [ @@ -615,7 +615,7 @@ # Add Add Menu items to the given menu def AddAddMenuItems(self, menu): [ID_ADD_BLOCK, ID_ADD_VARIABLE, ID_ADD_CONNECTION, - ID_ADD_COMMENT] = [wx.NewId() for i in xrange(4)] + ID_ADD_COMMENT] = [wx.NewId() for dummy in xrange(4)] # Create menu items self.AddMenuItems(menu, [ @@ -627,7 +627,7 @@ if self.CurrentLanguage != "FBD": [ ID_ADD_POWER_RAIL, ID_ADD_CONTACT, ID_ADD_COIL, - ] = [wx.NewId() for i in xrange(3)] + ] = [wx.NewId() for dummy in xrange(3)] # Create menu items self.AddMenuItems(menu, [ @@ -644,7 +644,7 @@ [ ID_ADD_INITIAL_STEP, ID_ADD_STEP, ID_ADD_TRANSITION, ID_ADD_ACTION_BLOCK, ID_ADD_DIVERGENCE, ID_ADD_JUMP, - ] = [wx.NewId() for i in xrange(6)] + ] = [wx.NewId() for dummy in xrange(6)] # Create menu items self.AddMenuItems(menu, [ @@ -662,7 +662,7 @@ # Add Default Menu items to the given menu def AddDefaultMenuItems(self, menu, edit=False, block=False): if block: - [ID_EDIT_BLOCK, ID_DELETE, ID_ADJUST_BLOCK_SIZE] = [wx.NewId() for i in xrange(3)] + [ID_EDIT_BLOCK, ID_DELETE, ID_ADJUST_BLOCK_SIZE] = [wx.NewId() for dummy in xrange(3)] # Create menu items self.AddMenuItems(menu, [ @@ -673,7 +673,7 @@ menu.Enable(ID_EDIT_BLOCK, edit) else: - [ID_CLEAR_EXEC_ORDER, ID_RESET_EXEC_ORDER] = [wx.NewId() for i in xrange(2)] + [ID_CLEAR_EXEC_ORDER, ID_RESET_EXEC_ORDER] = [wx.NewId() for dummy in xrange(2)] # Create menu items if self.CurrentLanguage == 'FBD': @@ -688,7 +688,7 @@ menu.AppendSeparator() - [ID_CUT, ID_COPY, ID_PASTE] = [wx.NewId() for i in xrange(3)] + [ID_CUT, ID_COPY, ID_PASTE] = [wx.NewId() for dummy in xrange(3)] # Create menu items self.AddMenuItems(menu, [ @@ -764,12 +764,12 @@ dc = wx.ClientDC(self.Editor) font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["mono"]) dc.SetFont(font) - width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ") + width, _height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ") while width > 260: faces["size"] -= 1 font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["mono"]) dc.SetFont(font) - width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ") + width, _height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ") self.SetFont(font) self.MiniTextDC = wx.MemoryDC() self.MiniTextDC.SetFont(wx.Font(faces["size"] * 0.75, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["helv"])) @@ -1295,7 +1295,7 @@ def GetPreviousSteps(self, connectors): steps = [] for connector in connectors: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): previous = wire.GetOtherConnected(connector).GetParentBlock() if isinstance(previous, SFC_Step): steps.append(previous.GetName()) @@ -1307,7 +1307,7 @@ def GetNextSteps(self, connectors): steps = [] for connector in connectors: - for wire, handle in connector.GetWires(): + for wire, _handle in connector.GetWires(): next = wire.GetOtherConnected(connector).GetParentBlock() if isinstance(next, SFC_Step): steps.append(next.GetName()) @@ -1559,7 +1559,7 @@ return None def FindBlockConnector(self, pos, direction=None, exclude=None): - result, error = self.FindBlockConnectorWithError(pos, direction, exclude) + result, _error = self.FindBlockConnectorWithError(pos, direction, exclude) return result def FindBlockConnectorWithError(self, pos, direction=None, exclude=None): @@ -3565,7 +3565,7 @@ self.SearchParams = search_params self.SearchResults = [] blocks = [] - for infos, start, end, text in self.Controler.SearchInPou(self.TagName, search_params, self.Debug): + for infos, start, end, _text in self.Controler.SearchInPou(self.TagName, search_params, self.Debug): if (infos[0] == self.TagName or self.TagName.split("::")[0] in ['A', 'T']) and infos[1] is not 'name': if infos[1] in ["var_local", "var_input", "var_output", "var_inout"]: self.SearchResults.append((infos[1:], start, end, SEARCH_RESULT_HIGHLIGHT)) diff -r 14b40afccd69 -r 6198190bc121 graphics/FBD_Objects.py --- a/graphics/FBD_Objects.py Tue Oct 03 16:31:31 2017 +0300 +++ b/graphics/FBD_Objects.py Thu Oct 05 16:38:49 2017 +0300 @@ -252,7 +252,7 @@ outputs = [output for output in blocktype["outputs"]] if blocktype["extensible"]: start = int(inputs[-1][0].replace("IN", "")) - for i in xrange(self.Extension - len(blocktype["inputs"])): + for dummy in xrange(self.Extension - len(blocktype["inputs"])): start += 1 inputs.append(("IN%d" % start, inputs[-1][1], inputs[-1][2])) comment = blocktype["comment"] @@ -352,12 +352,12 @@ # Calculate the inputs maximum width max_input = 0 for input in self.Inputs: - w, h = input.GetNameSize() + w, _h = input.GetNameSize() max_input = max(max_input, w) # Calculate the outputs maximum width max_output = 0 for output in self.Outputs: - w, h = output.GetNameSize() + w, _h = output.GetNameSize() max_output = max(max_output, w) width = max(self.TypeSize[0] + 10, max_input + max_output + 15) height = (max(len(self.Inputs), len(self.Outputs)) + 1) * BLOCK_LINE_SIZE diff -r 14b40afccd69 -r 6198190bc121 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Tue Oct 03 16:31:31 2017 +0300 +++ b/graphics/GraphicCommons.py Thu Oct 05 16:38:49 2017 +0300 @@ -238,7 +238,7 @@ dc.SetPen(wx.TRANSPARENT_PEN) for start, end, highlight_type in highlights: dc.SetBrush(wx.Brush(highlight_type[0])) - offset_width, offset_height = dc.GetTextExtent(text[:start[1]]) + offset_width, _offset_height = dc.GetTextExtent(text[:start[1]]) part = text[start[1]:end[1] + 1] part_width, part_height = dc.GetTextExtent(part) dc.DrawRectangle(x + offset_width, y, part_width, part_height) @@ -957,7 +957,7 @@ # Refreshes the group elements to move defined and handle selected def ProcessDragging(self, movex, movey, event, scaling): - handle_type, handle = self.Handle + handle_type, _handle = self.Handle # If it is a move handle, Move this group elements if handle_type == HANDLE_MOVE: movex = max(-self.BoundingBox.x, movex) @@ -1055,7 +1055,7 @@ def Flush(self): self.ParentBlock = None - for wire, handle in self.Wires: + for wire, _handle in self.Wires: wire.Flush() self.Wires = [] @@ -1128,7 +1128,7 @@ # Returns the connector type def GetConnectedRedrawRect(self, movex, movey): rect = None - for wire, handle in self.Wires: + for wire, _handle in self.Wires: if rect is None: rect = wire.GetRedrawRect() else: @@ -1143,7 +1143,7 @@ # Changes the connector name def SetType(self, type): self.Type = type - for wire, handle in self.Wires: + for wire, _handle in self.Wires: wire.SetValid(wire.IsConnectedCompatible()) # Returns the connector name @@ -1184,7 +1184,7 @@ def RefreshForced(self): self.Forced = False - for wire, handle in self.Wires: + for wire, _handle in self.Wires: self.Forced |= wire.IsForced() def RefreshValue(self): @@ -1192,12 +1192,12 @@ def RefreshValid(self): self.Valid = True - for wire, handle in self.Wires: + for wire, _handle in self.Wires: self.Valid &= wire.GetValid() def ReceivingCurrent(self): current = False - for wire, handle in self.Wires: + for wire, _handle in self.Wires: value = wire.GetValue() if current != "undefined" and isinstance(value, BooleanType): current |= wire.GetValue() @@ -1206,7 +1206,7 @@ return current def SpreadCurrent(self, spreading): - for wire, handle in self.Wires: + for wire, _handle in self.Wires: wire.SetValue(spreading) # Changes the connector name size @@ -1273,7 +1273,7 @@ # Returns the index of the wire given in the list of connected def GetWireIndex(self, wire): - for i, (tmp_wire, handle) in enumerate(self.Wires): + for i, (tmp_wire, _handle) in enumerate(self.Wires): if tmp_wire == wire: return i return None @@ -1427,7 +1427,7 @@ # Adds an highlight to the connector def AddHighlight(self, infos, start, end, highlight_type): if highlight_type == ERROR_HIGHLIGHT: - for wire, handle in self.Wires: + for wire, _handle in self.Wires: wire.SetValid(False) AddHighlight(self.Highlights, (start, end, highlight_type)) @@ -1441,7 +1441,7 @@ error |= highlight == ERROR_HIGHLIGHT self.Highlights = highlights if not error: - for wire, handle in self.Wires: + for wire, _handle in self.Wires: wire.SetValid(wire.IsConnectedCompatible()) # Removes all the highlights of one particular type from the connector @@ -1457,7 +1457,7 @@ error |= highlight == ERROR_HIGHLIGHT self.Highlights = highlights if not error: - for wire, handle in self.Wires: + for wire, _handle in self.Wires: wire.SetValid(wire.IsConnectedCompatible()) # Draws the connector @@ -1984,7 +1984,7 @@ if verify and 0 < i < len(self.Points) - 2 and \ self.Points[i] == self.Points[i + 1] and \ self.Segments[-1] == vector(self.Points[i + 1], self.Points[i + 2]): - for j in xrange(2): + for dummy in xrange(2): self.Points.pop(i) else: segment = vector(self.Points[i], self.Points[i + 1]) @@ -2206,7 +2206,7 @@ i = 1 while i < len(points) - 1: if points[i] == points[i + 1] and segments[i - 1] == segments[i + 1]: - for j in xrange(2): + for dummy in xrange(2): points.pop(i) segments.pop(i) else: @@ -2431,8 +2431,8 @@ def DeleteSegment(self): handle_type, handle = self.Handle if handle_type == HANDLE_SEGMENT: - segment, dir = handle - for i in xrange(2): + segment, _dir = handle + for dummy in xrange(2): self.Points.pop(segment) self.Segments.pop(segment) self.GeneratePoints() diff -r 14b40afccd69 -r 6198190bc121 graphics/LD_Objects.py --- a/graphics/LD_Objects.py Tue Oct 03 16:31:31 2017 +0300 +++ b/graphics/LD_Objects.py Thu Oct 05 16:38:49 2017 +0300 @@ -233,7 +233,7 @@ self.Type = type self.Clean() self.Connectors = [] - for connector in xrange(connectors): + for dummy in xrange(connectors): self.AddConnector() self.RefreshSize() diff -r 14b40afccd69 -r 6198190bc121 graphics/SFC_Objects.py --- a/graphics/SFC_Objects.py Tue Oct 03 16:31:31 2017 +0300 +++ b/graphics/SFC_Objects.py Thu Oct 05 16:38:49 2017 +0300 @@ -453,7 +453,7 @@ # Refreshes the step state according to move defined and handle selected def ProcessDragging(self, movex, movey, event, scaling): - handle_type, handle = self.Handle + handle_type, _handle = self.Handle if handle_type == HANDLE_MOVE: movex = max(-self.BoundingBox.x, movex) movey = max(-self.BoundingBox.y, movey) @@ -1588,7 +1588,7 @@ # Refresh the jump bounding box def RefreshBoundingBox(self): - text_width, text_height = self.Parent.GetTextExtent(self.Target) + text_width, _text_height = self.Parent.GetTextExtent(self.Target) # Calculate the bounding box size bbx_width = self.Size[0] + 2 + text_width self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE, @@ -1952,7 +1952,7 @@ # Refreshes the action block state according to move defined and handle selected def ProcessDragging(self, movex, movey, event, scaling): if self.Parent.GetDrawingMode() != FREEDRAWING_MODE: - handle_type, handle = self.Handle + handle_type, _handle = self.Handle if handle_type == HANDLE_MOVE: movex = max(-self.BoundingBox.x, movex) if scaling is not None: diff -r 14b40afccd69 -r 6198190bc121 i18n/mki18n.py --- a/i18n/mki18n.py Tue Oct 03 16:31:31 2017 +0300 +++ b/i18n/mki18n.py Thu Oct 05 16:38:49 2017 +0300 @@ -99,9 +99,9 @@ languageDict = {} if wx.VERSION >= (3, 0, 0): - app = wx.App() - else: - app = wx.PySimpleApp() + _app = wx.App() + else: + _app = wx.PySimpleApp() for lang in [x for x in dir(wx) if x.startswith("LANGUAGE")]: i = wx.Locale(wx.LANGUAGE_DEFAULT).GetLanguageInfo(getattr(wx, lang)) diff -r 14b40afccd69 -r 6198190bc121 plcopen/structures.py --- a/plcopen/structures.py Tue Oct 03 16:31:31 2017 +0300 +++ b/plcopen/structures.py Thu Oct 05 16:38:49 2017 +0300 @@ -51,7 +51,7 @@ """ Returns list of all types that correspont to the ANY* meta type """ - return [typename for typename, parenttype in TypeHierarchy.items() if not typename.startswith("ANY") and IsOfType(typename, type)] + return [typename for typename, _parenttype in TypeHierarchy.items() if not typename.startswith("ANY") and IsOfType(typename, type)] DataTypeRange = dict(DataTypeRange_list) diff -r 14b40afccd69 -r 6198190bc121 runtime/PLCObject.py --- a/runtime/PLCObject.py Tue Oct 03 16:31:31 2017 +0300 +++ b/runtime/PLCObject.py Thu Oct 05 16:38:49 2017 +0300 @@ -271,7 +271,7 @@ runtime python files, loaded when new PLC uploaded """ for method in self.python_runtime_vars.get("_runtime_%s" % methodname, []): - res, exp = self.evaluator(method) + _res, exp = self.evaluator(method) if exp is not None: self.LogMessage(0, '\n'.join(traceback.format_exception(*exp))) @@ -482,7 +482,7 @@ self._ResetDebugVariables() for idx, iectype, force in idxs: if force is not None: - c_type, unpack_func, pack_func = \ + c_type, _unpack_func, pack_func = \ TypeTranslator.get(iectype, (None, None, None)) force = ctypes.byref(pack_func(c_type, force)) @@ -558,7 +558,7 @@ try: exec script in kwargs except Exception: - e_type, e_value, e_traceback = sys.exc_info() + _e_type, e_value, e_traceback = sys.exc_info() line_no = traceback.tb_lineno(get_last_traceback(e_traceback)) return (-1, "RemoteExec script failed!\n\nLine %d: %s\n\t%s" % (line_no, e_value, script.splitlines()[line_no - 1])) diff -r 14b40afccd69 -r 6198190bc121 runtime/ServicePublisher.py --- a/runtime/ServicePublisher.py Tue Oct 03 16:31:31 2017 +0300 +++ b/runtime/ServicePublisher.py Thu Oct 05 16:38:49 2017 +0300 @@ -89,7 +89,7 @@ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.connect((dst, 7)) - (host, port) = s.getsockname() + (host, _port) = s.getsockname() s.close() if host != '0.0.0.0': return host diff -r 14b40afccd69 -r 6198190bc121 svgui/pyjs/jsonrpc/jsonrpc.py --- a/svgui/pyjs/jsonrpc/jsonrpc.py Tue Oct 03 16:31:31 2017 +0300 +++ b/svgui/pyjs/jsonrpc/jsonrpc.py Thu Oct 05 16:38:49 2017 +0300 @@ -32,10 +32,10 @@ result = self.methods[method](*params) return self.response(id, result) except BaseException: - etype, eval, etb = sys.exc_info() + etype, eval, _etb = sys.exc_info() return self.error(id, 100, '%s: %s' % (etype.__name__, eval)) except Exception: - etype, eval, etb = sys.exc_info() + etype, eval, _etb = sys.exc_info() return self.error(id, 100, 'Exception %s: %s' % (etype, eval)) else: return self.error(id, 100, 'method "%s" does not exist' % method) diff -r 14b40afccd69 -r 6198190bc121 svgui/pyjs/lib/pyjslib.py --- a/svgui/pyjs/lib/pyjslib.py Tue Oct 03 16:31:31 2017 +0300 +++ b/svgui/pyjs/lib/pyjslib.py Thu Oct 05 16:38:49 2017 +0300 @@ -219,8 +219,8 @@ def get_module(module_name): - ev = "__mod = %s;" % module_name - JS("pyjs_eval(ev);") + _ev = "__mod = %s;" % module_name + JS("pyjs_eval(_ev);") return __mod @@ -1408,8 +1408,8 @@ JS(" var mths = {}; ") if methods: for k in methods.keys(): - mth = methods[k] - JS(" mths[k] = mth; ") + _mth = methods[k] + JS(" mths[k] = _mth; ") JS(" var bss = null; ") if bases: diff -r 14b40afccd69 -r 6198190bc121 svgui/pyjs/pyjs.py --- a/svgui/pyjs/pyjs.py Tue Oct 03 16:31:31 2017 +0300 +++ b/svgui/pyjs/pyjs.py Thu Oct 05 16:38:49 2017 +0300 @@ -397,7 +397,7 @@ if arg_names and arg_names[0] == self.method_self: default_pos -= 1 self.printo(function_name+'.parse_kwargs = function (', ", ".join(["__kwargs"]+arg_names), ") {") - for default_node in node.defaults: + for _default_node in node.defaults: # default_value = self.expr(default_node, current_klass) # if isinstance(default_node, ast.Const): # default_value = self._const(default_node) @@ -1664,7 +1664,7 @@ if os.path.isfile(full_file_name): return full_file_name - fnameinit, ext = os.path.splitext(file_name) + fnameinit, _ext = os.path.splitext(file_name) fnameinit = fnameinit + "/__init__.py" full_file_name = os.path.join( diff -r 14b40afccd69 -r 6198190bc121 targets/Xenomai/__init__.py --- a/targets/Xenomai/__init__.py Tue Oct 03 16:31:31 2017 +0300 +++ b/targets/Xenomai/__init__.py Thu Oct 05 16:38:49 2017 +0300 @@ -34,9 +34,9 @@ xeno_config = self.CTRInstance.GetTarget().getcontent().getXenoConfig() if xeno_config: from util.ProcessLogger import ProcessLogger - status, result, err_result = ProcessLogger(self.CTRInstance.logger, - xeno_config + " --skin=native --"+flagsname, - no_stdout=True).spin() + status, result, _err_result = ProcessLogger(self.CTRInstance.logger, + xeno_config + " --skin=native --"+flagsname, + no_stdout=True).spin() if status: self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n") % flagsname) return [result.strip()] diff -r 14b40afccd69 -r 6198190bc121 targets/__init__.py --- a/targets/__init__.py Tue Oct 03 16:31:31 2017 +0300 +++ b/targets/__init__.py Thu Oct 05 16:38:49 2017 +0300 @@ -72,7 +72,7 @@ DictXSD_toolchain["toolchain_"+toolchainname] = open(xsdfilename).read() # Get all xsd targets - for targetname, nfo in targets.iteritems(): + for _targetname, nfo in targets.iteritems(): xsd_string = open(nfo["xsd"]).read() targetchoices += xsd_string % DictXSD_toolchain @@ -81,7 +81,7 @@ def GetTargetCode(targetname): codedesc = targets[targetname]["code"] - code = "\n".join([open(fpath).read() for fname, fpath in sorted(codedesc.items())]) + code = "\n".join([open(fpath).read() for _fname, fpath in sorted(codedesc.items())]) return code diff -r 14b40afccd69 -r 6198190bc121 targets/toolchain_gcc.py --- a/targets/toolchain_gcc.py Tue Oct 03 16:31:31 2017 +0300 +++ b/targets/toolchain_gcc.py Thu Oct 05 16:38:49 2017 +0300 @@ -143,9 +143,9 @@ def calc_source_md5(self): wholesrcdata = "" - for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: + for _Location, CFilesAndCFLAGS, _DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: # Get CFiles list to give it to makefile - for CFile, CFLAGS in CFilesAndCFLAGS: + for CFile, _CFLAGS in CFilesAndCFLAGS: CFileName = os.path.basename(CFile) wholesrcdata += self.concat_deps(CFileName) return hashlib.md5(wholesrcdata).hexdigest() @@ -164,7 +164,7 @@ obns = [] objs = [] relink = self.GetBinaryCode() is None - for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: + for Location, CFilesAndCFLAGS, _DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: if CFilesAndCFLAGS: if Location: self.CTRInstance.logger.write(".".join(map(str, Location))+" :\n") @@ -186,7 +186,7 @@ self.CTRInstance.logger.write(" [CC] "+bn+" -> "+obn+"\n") - status, result, err_result = ProcessLogger( + status, _result, _err_result = ProcessLogger( self.CTRInstance.logger, "\"%s\" -c \"%s\" -o \"%s\" %s %s" % (self.compiler, CFile, objectfilename, Builder_CFLAGS, CFLAGS) @@ -213,7 +213,7 @@ self.CTRInstance.logger.write(" [CC] " + ' '.join(obns)+" -> " + self.exe + "\n") - status, result, err_result = ProcessLogger( + status, _result, _err_result = ProcessLogger( self.CTRInstance.logger, "\"%s\" %s -o \"%s\" %s" % (self.linker, diff -r 14b40afccd69 -r 6198190bc121 targets/toolchain_makefile.py --- a/targets/toolchain_makefile.py Tue Oct 03 16:31:31 2017 +0300 +++ b/targets/toolchain_makefile.py Thu Oct 05 16:38:49 2017 +0300 @@ -88,7 +88,7 @@ srcfiles = [] cflags = [] wholesrcdata = "" - for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: + for _Location, CFilesAndCFLAGS, _DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: # Get CFiles list to give it to makefile for CFile, CFLAGS in CFilesAndCFLAGS: CFileName = os.path.basename(CFile) @@ -118,8 +118,8 @@ command = [token % beremizcommand for token in cmd.split(' ')] # Call Makefile to build PLC code and link it with target specific code - status, result, err_result = ProcessLogger(self.CTRInstance.logger, - command).spin() + status, _result, _err_result = ProcessLogger(self.CTRInstance.logger, + command).spin() if status: self.md5key = None self.CTRInstance.logger.write_error(_("C compilation failed.\n")) diff -r 14b40afccd69 -r 6198190bc121 targets/typemapping.py --- a/targets/typemapping.py Tue Oct 03 16:31:31 2017 +0300 +++ b/targets/typemapping.py Thu Oct 05 16:38:49 2017 +0300 @@ -100,7 +100,7 @@ buffsize = len(buff) buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value for iectype in indexes: - c_type, unpack_func, pack_func = \ + c_type, unpack_func, _pack_func = \ TypeTranslator.get(iectype, (None, None, None)) if c_type is not None and buffoffset < buffsize: cursor = c_void_p(buffptr + buffoffset) diff -r 14b40afccd69 -r 6198190bc121 tests/tools/test_CustomIntCtrl.py --- a/tests/tools/test_CustomIntCtrl.py Tue Oct 03 16:31:31 2017 +0300 +++ b/tests/tools/test_CustomIntCtrl.py Thu Oct 05 16:38:49 2017 +0300 @@ -112,7 +112,7 @@ self.assertEqual(val, val) def ProcessEvents(self): - for i in range(0, 10): + for dummy in range(0, 10): wx.Yield() time.sleep(0.01) diff -r 14b40afccd69 -r 6198190bc121 tests/tools/test_application.py --- a/tests/tools/test_application.py Tue Oct 03 16:31:31 2017 +0300 +++ b/tests/tools/test_application.py Thu Oct 05 16:38:49 2017 +0300 @@ -74,7 +74,7 @@ raise self.exc_info[0], self.exc_info[1], self.exc_info[2] def ProcessEvents(self): - for i in range(0, 30): + for dummy in range(0, 30): self.CheckForErrors() wx.Yield() time.sleep(0.01) diff -r 14b40afccd69 -r 6198190bc121 util/TranslationCatalogs.py --- a/util/TranslationCatalogs.py Tue Oct 03 16:31:31 2017 +0300 +++ b/util/TranslationCatalogs.py Thu Oct 05 16:38:49 2017 +0300 @@ -24,8 +24,10 @@ import os import __builtin__ +import gettext import wx + locale = None diff -r 14b40afccd69 -r 6198190bc121 util/misc.py --- a/util/misc.py Tue Oct 03 16:31:31 2017 +0300 +++ b/util/misc.py Thu Oct 05 16:38:49 2017 +0300 @@ -28,6 +28,7 @@ import os import sys +import gettext def CheckPathPerm(path): @@ -56,11 +57,9 @@ def InstallLocalRessources(CWD): from BitmapLibrary import AddBitmapFolder from TranslationCatalogs import AddCatalog - import wx # Beremiz bitmaps AddBitmapFolder(os.path.join(CWD, "images")) # Internationalization AddCatalog(os.path.join(CWD, "locale")) - import gettext diff -r 14b40afccd69 -r 6198190bc121 util/paths.py --- a/util/paths.py Tue Oct 03 16:31:31 2017 +0300 +++ b/util/paths.py Thu Oct 05 16:38:49 2017 +0300 @@ -43,6 +43,6 @@ def AbsParentDir(file, level=1): path = AbsDir(file) - for i in range(0, level): + for dummy in range(0, level): path = os.path.dirname(path) return path diff -r 14b40afccd69 -r 6198190bc121 xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Tue Oct 03 16:31:31 2017 +0300 +++ b/xmlclass/xmlclass.py Thu Oct 05 16:38:49 2017 +0300 @@ -589,7 +589,7 @@ def GenerateTag(value, name=None, indent=0): if name is not None and not (infos["minOccurs"] == 0 and value is None): - ind1, ind2 = getIndent(indent, name) + ind1, _ind2 = getIndent(indent, name) return ind1 + "<%s/>\n" % name else: return "" @@ -626,7 +626,7 @@ DefaultElementClass.__setattr__(value, "tag", element_name) value._init_() return value - return [initial_value() for i in xrange(infos["minOccurs"])] + return [initial_value() for dummy in xrange(infos["minOccurs"])] else: return [] @@ -689,7 +689,7 @@ content_name, infos = choices[0] if content_name == "sequence": content_value = [] - for i in xrange(infos["minOccurs"]): + for dummy in xrange(infos["minOccurs"]): for element_infos in infos["elements"]: content_value.extend(GetElementInitialValue(factory, element_infos)) else: diff -r 14b40afccd69 -r 6198190bc121 xmlclass/xsdschema.py --- a/xmlclass/xsdschema.py Tue Oct 03 16:31:31 2017 +0300 +++ b/xmlclass/xsdschema.py Thu Oct 05 16:38:49 2017 +0300 @@ -41,7 +41,7 @@ def generateXMLTextMethod(value, name=None, indent=0): text = "" if name is not None: - ind1, ind2 = getIndent(indent, name) + ind1, _ind2 = getIndent(indent, name) text += ind1 + "<%s>" % name text += function(value) if name is not None: @@ -57,7 +57,7 @@ def generateXMLTextMethod(value, name=None, indent=0): text = "" if name is not None: - ind1, ind2 = getIndent(indent, name) + ind1, _ind2 = getIndent(indent, name) text += ind1 + "<%s>" % name if isinstance(value, IntType): text += str(value) @@ -99,7 +99,7 @@ def ReduceAnnotation(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + _annotations, children = factory.ReduceElements(elements) annotation = {"type": "annotation", "appinfo": [], "documentation": {}} for child in children: if child["type"] == "appinfo": @@ -120,7 +120,7 @@ def GenerateFacetReducing(facetname, canbefixed): def ReduceFacet(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + annotations, _children = factory.ReduceElements(elements) if "value" in attributes: facet = {"type": facetname, "value": attributes["value"], "doc": annotations} if canbefixed: @@ -304,7 +304,7 @@ # Generate extract value for new created type def ExtractSimpleTypeValue(attr, extract=True): value = basetypeinfos["extract"](attr, extract) - for facetname, (facetvalue, facetfixed) in facets.items(): + for facetname, (facetvalue, _facetfixed) in facets.items(): if facetvalue is not None: if facetname == "enumeration" and value not in facetvalue: raise ValueError("\"%s\" not in enumerated values" % value) @@ -338,7 +338,7 @@ return value def CheckSimpleTypeValue(value): - for facetname, (facetvalue, facetfixed) in facets.items(): + for facetname, (facetvalue, _facetfixed) in facets.items(): if facetvalue is not None: if facetname == "enumeration" and value not in facetvalue: return False @@ -367,7 +367,7 @@ return True def SimpleTypeInitialValue(): - for facetname, (facetvalue, facetfixed) in facets.items(): + for facetname, (facetvalue, _facetfixed) in facets.items(): if facetvalue is not None: if facetname == "enumeration": return facetvalue[0] @@ -605,7 +605,7 @@ def ReduceComplexContent(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + _annotations, children = factory.ReduceElements(elements) complexContent = children[0].copy() complexContent["type"] = "complexContent" return complexContent @@ -718,7 +718,7 @@ # Elements groups def ReduceAny(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + annotations, _children = factory.ReduceElements(elements) any = {"type": ANY, "doc": annotations} any.update(attributes) @@ -878,7 +878,7 @@ def ReduceUnique(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + _annotations, children = factory.ReduceElements(elements) unique = {"type": CONSTRAINT, "const_type": "unique", "selector": children[0], "fields": children[1:]} unique.update(attributes) @@ -886,7 +886,7 @@ def ReduceKey(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + _annotations, children = factory.ReduceElements(elements) key = {"type": CONSTRAINT, "const_type": "key", "selector": children[0], "fields": children[1:]} key.update(attributes) @@ -894,7 +894,7 @@ def ReduceKeyRef(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + _annotations, children = factory.ReduceElements(elements) keyref = {"type": CONSTRAINT, "const_type": "keyref", "selector": children[0], "fields": children[1:]} keyref.update(attributes) @@ -902,7 +902,7 @@ def ReduceSelector(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + factory.ReduceElements(elements) selector = {"type": CONSTRAINT, "const_type": "selector"} selector.update(attributes) @@ -910,7 +910,7 @@ def ReduceField(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + factory.ReduceElements(elements) field = {"type": CONSTRAINT, "const_type": "field"} field.update(attributes) @@ -920,12 +920,12 @@ # Inclusion elements def ReduceImport(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + factory.ReduceElements(elements) raise ValueError("\"import\" element isn't supported yet!") def ReduceInclude(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + factory.ReduceElements(elements) if factory.FileName is None: raise ValueError("Include in XSD string not yet supported") @@ -950,7 +950,7 @@ def ReduceRedefine(factory, attributes, elements): - annotations, children = factory.ReduceElements(elements) + factory.ReduceElements(elements) raise ValueError("\"redefine\" element isn't supported yet!") @@ -968,7 +968,7 @@ factory.etreeNamespaceFormat = "{%s}%%s" % targetNamespace factory.Namespaces[factory.TargetNamespace] = {} - annotations, children = factory.ReduceElements(elements, True) + _annotations, children = factory.ReduceElements(elements, True) for child in children: if "name" in child: @@ -1089,7 +1089,7 @@ def CreateSchemaElement(self, element_name, element_type): for type, attributes, elements in self.Schema[2]: - namespace, name = DecomposeQualifiedName(type) + _namespace, name = DecomposeQualifiedName(type) if attributes.get("name", None) == element_name: element_infos = None if element_type in (ATTRIBUTE, None) and name == "attribute":