fix pylint warning '(pointless-string-statement) String statement has no effect'
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 29 Sep 2017 16:26:15 +0300
changeset 1837 c507c363625e
parent 1836 d42b6cf00fa6
child 1838 646245c1c0d9
fix pylint warning '(pointless-string-statement) String statement has no effect'

Python doesn't support docstring for variables directly. Where
appropriate Sphinx style for docstrings for variables is used
'#: some-docstring'
CodeFileTreeNode.py
connectors/PYRO/__init__.py
controls/EnhancedStatusBar.py
graphics/GraphicCommons.py
plcopen/definitions.py
plcopen/plcopen.py
tests/tools/check_source.sh
xmlclass/xmlclass.py
--- a/CodeFileTreeNode.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/CodeFileTreeNode.py	Fri Sep 29 16:26:15 2017 +0300
@@ -211,10 +211,10 @@
 #                      Current Buffering Management Functions
 # -------------------------------------------------------------------------------
 
-    """
-    Return a copy of the codefile model
-    """
     def Copy(self, model):
+        """
+        Return a copy of the codefile model
+        """
         return deepcopy(model)
 
     def CreateCodeFileBuffer(self, saved):
--- a/connectors/PYRO/__init__.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/connectors/PYRO/__init__.py	Fri Sep 29 16:26:15 2017 +0300
@@ -163,10 +163,9 @@
             """
             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
-                """
+                # Some bad libs with static symbols may polute PLC
+                # ask runtime to suicide and come back again
+
                 confnodesroot.logger.write(_("Force runtime reload\n"))
                 confnodesroot._connector.GetPyroProxy().ForceReload()
                 confnodesroot._Disconnect()
--- a/controls/EnhancedStatusBar.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/controls/EnhancedStatusBar.py	Fri Sep 29 16:26:15 2017 +0300
@@ -119,7 +119,7 @@
             if horizontalalignment == ESB_EXACT_FIT:
 
                 if verticalalignment == ESB_EXACT_FIT:
-                    """ 1 September 2015 Fix fit align """
+                    # 1 September 2015 Fix fit align
                     widget.SetSize((rect.width-4, rect.height-4))
                     widget.SetPosition((rect.x+2, rect.y+2))
                 elif verticalalignment == ESB_ALIGN_CENTER_VERTICAL:
--- a/graphics/GraphicCommons.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/graphics/GraphicCommons.py	Fri Sep 29 16:26:15 2017 +0300
@@ -34,12 +34,10 @@
 
 # -------------------------------------------------------------------------------
 #                               Common constants
+#
+#            Definition of constants for dimensions of graphic elements
 # -------------------------------------------------------------------------------
 
-"""
-Definition of constants for dimensions of graphic elements
-"""
-
 # FBD and SFC constants
 MIN_MOVE = 5                            # Minimum move before starting a element dragging
 CONNECTOR_SIZE = 8                      # Size of connectors
@@ -128,10 +126,9 @@
     return int(xround * n)
 
 
-"""
-Basic vector operations for calculate wire points
-"""
-
+# -------------------------------------------------------------------------------
+# Basic vector operations for calculate wire points
+# -------------------------------------------------------------------------------
 
 def vector(p1, p2, normal=True):
     """
--- a/plcopen/definitions.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/plcopen/definitions.py	Fri Sep 29 16:26:15 2017 +0300
@@ -66,11 +66,10 @@
 # -------------------------------------------------------------------------------
 
 
-"""
-Ordored list of common data types defined in the IEC 61131-3
-Each type is associated to his direct parent type. It defines then a hierarchy
-between type that permits to make a comparison of two types
-"""
+#: Ordored list of common data types defined in the IEC 61131-3
+#: Each type is associated to his direct parent type. It defines then a hierarchy
+#: between type that permits to make a comparison of two types
+
 TypeHierarchy_list = [
     ("ANY", None),
     ("ANY_DERIVED", "ANY"),
--- a/plcopen/plcopen.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/plcopen/plcopen.py	Fri Sep 29 16:26:15 2017 +0300
@@ -33,9 +33,10 @@
 from xmlclass import *
 import util.paths as paths
 
-"""
-Dictionary that makes the relation between var names in plcopen and displayed values
-"""
+
+#: Dictionary that makes the relation between var names
+#: in plcopen and displayed values
+
 VarTypes = {
     "Local":    "localVars",
     "Temp":     "tempVars",
@@ -53,18 +54,26 @@
     "inOutVars":  "var_inout"
 }
 
-"""
-Define in which order var types must be displayed
-"""
+
+#: Define in which order var types must be displayed
+
 VarOrder = ["Local", "Temp", "Input", "Output", "InOut", "External", "Global", "Access"]
 
-"""
-Define which action qualifier must be associated with a duration
-"""
+
+#:  Define which action qualifier must be associated with a duration
+
 QualifierList = OrderedDict([
-    ("N", False), ("R", False), ("S", False),
-    ("L", True), ("D", True), ("P", False), ("P0", False),
-    ("P1", False), ("SD", True), ("DS", True), ("SL", True)])
+    ("N", False),
+    ("R", False),
+    ("S", False),
+    ("L", True),
+    ("D", True),
+    ("P", False),
+    ("P0", False),
+    ("P1", False),
+    ("SD", True),
+    ("DS", True),
+    ("SL", True)])
 
 
 FILTER_ADDRESS_MODEL = "(%%[IQM](?:[XBWDL])?)(%s)((?:\.[0-9]+)*)"
--- a/tests/tools/check_source.sh	Fri Sep 29 15:36:33 2017 +0300
+++ b/tests/tools/check_source.sh	Fri Sep 29 16:26:15 2017 +0300
@@ -210,7 +210,8 @@
     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,W0403        # relative import
     # enable=$enable,W0622        # (redefined-builtin) Redefining built-in
     # enable=$enable,W0612        # unused-variable
--- a/xmlclass/xmlclass.py	Fri Sep 29 15:36:33 2017 +0300
+++ b/xmlclass/xmlclass.py	Fri Sep 29 16:26:15 2017 +0300
@@ -57,10 +57,9 @@
     node._attrs[name] = attr
 
 
-"""
-Regular expression models for checking all kind of string values defined in XML
-standard
-"""
+# Regular expression models for checking all kind of
+# string values defined in XML standard
+
 Name_model = re.compile('([a-zA-Z_\:][\w\.\-\:]*)$')
 Names_model = re.compile('([a-zA-Z_\:][\w\.\-\:]*(?: [a-zA-Z_\:][\w\.\-\:]*)*)$')
 NMToken_model = re.compile('([\w\.\-\:]*)$')
@@ -1011,10 +1010,10 @@
                       [[p] + self.GetEquivalentParents(p)
                        for p in self.EquivalentClassesParent.get(parent, {}).keys()], [])
 
-    """
-    Methods that generates the classes
-    """
     def CreateClasses(self):
+        """
+        Method that generates the classes
+        """
         self.ParseSchema()
         for name, infos in self.Namespaces[self.TargetNamespace].items():
             if infos["type"] == ELEMENT:
@@ -1187,10 +1186,10 @@
 
         return class_infos
 
-    """
-    Methods that print the classes generated
-    """
     def PrintClasses(self):
+        """
+        Method that print the classes generated
+        """
         items = self.ComputedClasses.items()
         items.sort()
         if self.FileName is not None:
@@ -1725,10 +1724,6 @@
     return countMethod
 
 
-"""
-This function generate a xml parser from a class factory
-"""
-
 NAMESPACE_PATTERN = re.compile("xmlns(?:\:[^\=]*)?=\"[^\"]*\" ")
 
 
@@ -1845,6 +1840,10 @@
 
 
 def GenerateParser(factory, xsdstring):
+    """
+    This function generate a xml parser from a class factory
+    """
+
     ComputedClasses = factory.CreateClasses()
 
     if factory.FileName is not None: