# HG changeset patch # User Andrey Skvortsov # Date 1506605105 -10800 # Node ID 2269739dd098fb870181cb017128718afe5f9caf # Parent 0f1081928d652c253ea18abc3d8d263cb3acb69f fix unnecessary lambda and enable corresponding pylint check diff -r 0f1081928d65 -r 2269739dd098 ConfigTreeNode.py --- a/ConfigTreeNode.py Thu Sep 28 15:17:57 2017 +0300 +++ b/ConfigTreeNode.py Thu Sep 28 16:25:05 2017 +0300 @@ -258,7 +258,7 @@ }, ...] @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND """ - self.GetCTRoot().logger.write_warning(".".join(map(lambda x: str(x), self.GetCurrentLocation())) + " -> Nothing to do\n") + self.GetCTRoot().logger.write_warning(".".join(map(str, self.GetCurrentLocation())) + " -> Nothing to do\n") return [], "", False def _Generate_C(self, buildpath, locations): diff -r 0f1081928d65 -r 2269739dd098 connectors/PYRO/__init__.py --- a/connectors/PYRO/__init__.py Thu Sep 28 15:17:57 2017 +0300 +++ b/connectors/PYRO/__init__.py Thu Sep 28 16:25:05 2017 +0300 @@ -134,7 +134,7 @@ # Check connection is effective. # lambda is for getattr of GetPLCstatus to happen inside catcher - if PyroCatcher(lambda: RemotePLCObjectProxy.GetPLCstatus())() is None: + if PyroCatcher(RemotePLCObjectProxy.GetPLCstatus)() is None: confnodesroot.logger.write_error(_("Cannot get PLC status - connection failed.\n")) return None diff -r 0f1081928d65 -r 2269739dd098 controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Sep 28 15:17:57 2017 +0300 +++ b/controls/VariablePanel.py Thu Sep 28 16:25:05 2017 +0300 @@ -140,7 +140,7 @@ value = getattr(self.data[row], colname, "") if colname == "Type" and isinstance(value, TupleType): if value[0] == "array": - return "ARRAY [%s] OF %s" % (",".join(map(lambda x: "..".join(x), value[2])), value[1]) + return "ARRAY [%s] OF %s" % (",".join(map("..".join, value[2])), value[1]) if not isinstance(value, (StringType, UnicodeType)): value = str(value) if colname in ["Class", "Option"]: diff -r 0f1081928d65 -r 2269739dd098 dialogs/ArrayTypeDialog.py --- a/dialogs/ArrayTypeDialog.py Thu Sep 28 15:17:57 2017 +0300 +++ b/dialogs/ArrayTypeDialog.py Thu Sep 28 16:25:05 2017 +0300 @@ -83,7 +83,7 @@ if isinstance(infos, TupleType) and infos[0] == "array": self.BaseType.SetStringSelection(infos[1]) - self.Dimensions.SetStrings(map(lambda x: "..".join(x), infos[2])) + self.Dimensions.SetStrings(map("..".join, infos[2])) elif infos in datatypes: self.BaseType.SetStringSelection(infos) diff -r 0f1081928d65 -r 2269739dd098 editors/DataTypeEditor.py --- a/editors/DataTypeEditor.py Thu Sep 28 15:17:57 2017 +0300 +++ b/editors/DataTypeEditor.py Thu Sep 28 16:25:05 2017 +0300 @@ -82,7 +82,7 @@ if colname == "Type" and isinstance(value, TupleType): if value[0] == "array": - return "ARRAY [%s] OF %s" % (",".join(map(lambda x: "..".join(x), value[2])), value[1]) + return "ARRAY [%s] OF %s" % (",".join(map("..".join, value[2])), value[1]) return value def SetValue(self, row, col, value): @@ -510,7 +510,7 @@ self.EnumeratedInitialValue.SetStringSelection(type_infos["initial"]) elif type_infos["type"] == "Array": self.ArrayBaseType.SetStringSelection(type_infos["base_type"]) - self.ArrayDimensions.SetStrings(map(lambda x: "..".join(x), type_infos["dimensions"])) + self.ArrayDimensions.SetStrings(map("..".join, type_infos["dimensions"])) self.ArrayInitialValue.SetValue(type_infos["initial"]) elif type_infos["type"] == "Structure": self.StructureElementsTable.SetData(type_infos["elements"]) diff -r 0f1081928d65 -r 2269739dd098 editors/TextViewer.py --- a/editors/TextViewer.py Thu Sep 28 15:17:57 2017 +0300 +++ b/editors/TextViewer.py Thu Sep 28 16:25:05 2017 +0300 @@ -70,7 +70,7 @@ def LineStartswith(line, symbols): - return reduce(lambda x, y: x or y, map(lambda x: line.startswith(x), symbols), False) + return reduce(lambda x, y: x or y, map(line.startswith, symbols), False) class TextViewer(EditorPanel): diff -r 0f1081928d65 -r 2269739dd098 py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Thu Sep 28 15:17:57 2017 +0300 +++ b/py_ext/PythonFileCTNMixin.py Thu Sep 28 16:25:05 2017 +0300 @@ -95,8 +95,7 @@ def CTNGenerate_C(self, buildpath, locations): # location string for that CTN - location_str = "_".join(map(lambda x: str(x), - self.GetCurrentLocation())) + location_str = "_".join(map(str, self.GetCurrentLocation())) configname = self.GetCTRoot().GetProjectConfigNames()[0] pyextname = self.CTNName() diff -r 0f1081928d65 -r 2269739dd098 svgui/svgui.py --- a/svgui/svgui.py Thu Sep 28 15:17:57 2017 +0300 +++ b/svgui/svgui.py Thu Sep 28 16:25:05 2017 +0300 @@ -86,7 +86,7 @@ current_location = self.GetCurrentLocation() # define a unique name for the generated C file - location_str = "_".join(map(lambda x: str(x), current_location)) + location_str = "_".join(map(str, current_location)) res = ([], "", False) diff -r 0f1081928d65 -r 2269739dd098 tests/tools/check_source.sh --- a/tests/tools/check_source.sh Thu Sep 28 15:17:57 2017 +0300 +++ b/tests/tools/check_source.sh Thu Sep 28 16:25:05 2017 +0300 @@ -192,19 +192,21 @@ export PYTHONPATH="$PWD/../CanFestival-3/objdictgen":$PYTHONPATH disable= - disable=$disable,C0103 # invalid-name - disable=$disable,C0111 # missing-docstring - disable=$disable,W0703 # broad-except - disable=$disable,C0326 # bad whitespace - disable=$disable,C0301 # Line too long - disable=$disable,C0302 # Too many lines in module - disable=$disable,W0511 # fixme + disable=$disable,C0103 # invalid-name + disable=$disable,C0111 # missing-docstring + disable=$disable,W0703 # broad-except + disable=$disable,C0326 # bad whitespace + disable=$disable,C0301 # Line too long + disable=$disable,C0302 # Too many lines in module + disable=$disable,W0511 # fixme + disable=$disable,W0110 # (deprecated-lambda) map/filter on lambda could be replaced by comprehension enable= enable=$enable,E1601 # print statement used 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,C0411 # (wrong-import-order), standard import "import x" comes before "import y" + enable=$enable,W0108 # (unnecessary-lambda), Lambda may not be necessary # enable=$enable,W0403 # relative import # enable=$enable,W0622 # (redefined-builtin) Redefining built-in