# HG changeset patch # User Andrey Skvortsov # Date 1538217246 -10800 # Node ID 88a9d64560d34d944f4624de8b5f8c02a28fde20 # Parent 47775c9367bdd70eb171191fdb007ef2903e4210 clean etherlab: pep8, W601 .has_key() is deprecated, use 'in' diff -r 47775c9367bd -r 88a9d64560d3 etherlab/EtherCATManagementEditor.py --- a/etherlab/EtherCATManagementEditor.py Sat Sep 29 13:30:41 2018 +0300 +++ b/etherlab/EtherCATManagementEditor.py Sat Sep 29 13:34:06 2018 +0300 @@ -1692,7 +1692,7 @@ row_data.append(hex_address) # append description - if self.RegisterDescriptionDict.has_key(hex_address): + if hex_address in self.RegisterDescriptionDict: row_data.append(self.RegisterDescriptionDict[hex_address]) else: row_data.append("") diff -r 47775c9367bd -r 88a9d64560d3 etherlab/EthercatCFileGenerator.py --- a/etherlab/EthercatCFileGenerator.py Sat Sep 29 13:30:41 2018 +0300 +++ b/etherlab/EthercatCFileGenerator.py Sat Sep 29 13:34:06 2018 +0300 @@ -75,7 +75,7 @@ raise ValueError, _("Type of location \"%s\" not yet supported!") % entry_infos["var_name"] if not entry_infos.get("no_decl", False): - if entry_infos.has_key("real_var"): + if "real_var" in entry_infos: str_completion["located_variables_declaration"].append( "IEC_%(var_type)s %(real_var)s;" % entry_infos) else: @@ -87,7 +87,7 @@ entry_infos["extra_decl"] = declaration str_completion["located_variables_declaration"].append( "IEC_%(var_type)s *%(extra_decl)s = &%(real_var)s;" % entry_infos) - elif not entry_infos.has_key("real_var"): + elif "real_var" not in entry_infos: entry_infos["real_var"] = "beremiz" + entry_infos["var_name"] str_completion["used_pdo_entry_offset_variables_declaration"].append( @@ -490,7 +490,7 @@ else: raise ValueError, _("Wrong direction for location \"%s\"!") % entry_infos["var_name"] - if not dynamic_pdos.has_key(pdo_type): + if pdo_type not in dynamic_pdos: raise ValueError, _("No Sync manager defined for %s!") % pdo_type ConfigureVariable(entry_infos, str_completion) diff -r 47775c9367bd -r 88a9d64560d3 etherlab/etherlab.py --- a/etherlab/etherlab.py Sat Sep 29 13:30:41 2018 +0300 +++ b/etherlab/etherlab.py Sat Sep 29 13:34:06 2018 +0300 @@ -240,7 +240,7 @@ for device in self.devices_xpath(self.modules_infos): device_group = device.getGroupType() - if not vendor_category["groups"].has_key(device_group): + if device_group not in vendor_category["groups"]: raise ValueError, "Not such group \"%\"" % device_group vendor_category["groups"][device_group]["devices"].append( (device.getType().getcontent(), device))