DocumentationTools/ModuleDocumentor.py

changeset 5587
ea526b78ee6c
parent 5389
9b1c800daff3
child 6048
82ad8ec9548c
diff -r 0e5421d679e7 -r ea526b78ee6c DocumentationTools/ModuleDocumentor.py
--- a/DocumentationTools/ModuleDocumentor.py	Tue Mar 07 18:46:09 2017 +0100
+++ b/DocumentationTools/ModuleDocumentor.py	Tue Mar 07 18:53:18 2017 +0100
@@ -302,24 +302,25 @@
         return "{0}{1}{2}{3}".format(
             modBody, classesSection, rbModulesSection, functionsSection)
         
-    def __genListSection(self, names, dict, kwSuffix=""):
+    def __genListSection(self, names, sectionDict, kwSuffix=""):
         """
         Private method to generate a list section of the document.
         
         @param names The names to appear in the list. (list of strings)
-        @param dict A dictionary containing all relevant information.
+        @param sectionDict dictionary containing all relevant information
+            (dict)
         @param kwSuffix suffix to be used for the QtHelp keywords (string)
-        @return The list section. (string)
+        @return list section (string)
         """
         lst = []
         for name in names:
             lst.append(self.listEntryTemplate.format(
                 **{'Link': "{0}".format(name),
-                   'Name': dict[name].name,
+                   'Name': sectionDict[name].name,
                    'Description':
-                    self.__getShortDescription(dict[name].description),
+                    self.__getShortDescription(sectionDict[name].description),
                    'Deprecated':
-                    self.__checkDeprecated(dict[name].description) and
+                    self.__checkDeprecated(sectionDict[name].description) and
                     self.listEntryDeprecatedTemplate or "",
                    }))
             if kwSuffix:
@@ -342,8 +343,8 @@
             scope = class_
         else:
             scope = self.module
-        attrNames = sorted([attr for attr in scope.globals.keys()
-                           if not scope.globals[attr].isSignal])
+        attrNames = sorted(attr for attr in scope.globals.keys()
+                           if not scope.globals[attr].isSignal)
         if attrNames:
             s = ''.join(
                 [self.listEntrySimpleTemplate.format(**{'Name': name})
@@ -449,13 +450,14 @@
             
         return ''.join(classes)
         
-    def __genMethodsListSection(self, names, dict, className, clsName,
+    def __genMethodsListSection(self, names, sectionDict, className, clsName,
                                 includeInit=True):
         """
         Private method to generate the methods list section of a class.
         
         @param names names to appear in the list (list of strings)
-        @param dict dictionary containing all relevant information
+        @param sectionDict dictionary containing all relevant information
+            (dict)
         @param className class name containing the names
         @param clsName visible class name containing the names
         @param includeInit flag indicating to include the __init__ method
@@ -469,9 +471,9 @@
                     **{'Link': "{0}.{1}".format(className, '__init__'),
                        'Name': clsName,
                        'Description': self.__getShortDescription(
-                           dict['__init__'].description),
+                           sectionDict['__init__'].description),
                        'Deprecated': self.__checkDeprecated(
-                           dict['__init__'].description) and
+                           sectionDict['__init__'].description) and
                         self.listEntryDeprecatedTemplate or "",
                        }))
                 self.keywords.append(
@@ -483,30 +485,30 @@
         for name in names:
             lst.append(self.listEntryTemplate.format(
                 **{'Link': "{0}.{1}".format(className, name),
-                   'Name': dict[name].name,
+                   'Name': sectionDict[name].name,
                    'Description':
-                    self.__getShortDescription(dict[name].description),
+                    self.__getShortDescription(sectionDict[name].description),
                    'Deprecated':
-                    self.__checkDeprecated(dict[name].description) and
+                    self.__checkDeprecated(sectionDict[name].description) and
                     self.listEntryDeprecatedTemplate or "",
                    }))
             self.keywords.append(("{0}.{1}".format(className, name),
                                   "#{0}.{1}".format(className, name)))
         return ''.join(lst)
         
-    def __genMethodSection(self, obj, className, filter):
+    def __genMethodSection(self, obj, className, modifierFilter):
         """
         Private method to generate the method details section.
         
         @param obj reference to the object being formatted
         @param className name of the class containing the method (string)
-        @param filter filter value designating the method types
+        @param modifierFilter filter value designating the method types
         @return method list and method details section (tuple of two string)
         """
         methList = []
         methBodies = []
-        methods = sorted([k for k in obj.methods.keys()
-                          if obj.methods[k].modifier == filter])
+        methods = sorted(k for k in obj.methods.keys()
+                         if obj.methods[k].modifier == modifierFilter)
         if '__init__' in methods:
             methods.remove('__init__')
             try:
@@ -530,9 +532,9 @@
                 methBody = ""
             methBodies.append(methBody)
         
-        if filter == Function.Class:
+        if modifierFilter == Function.Class:
             methodClassifier = " (class method)"
-        elif filter == Function.Static:
+        elif modifierFilter == Function.Static:
             methodClassifier = " (static)"
         else:
             methodClassifier = ""
@@ -560,7 +562,7 @@
             
         methList = self.__genMethodsListSection(
             methods, obj.methods, className, obj.name,
-            includeInit=filter == Function.General)
+            includeInit=modifierFilter == Function.General)
         
         if not methList:
             methList = self.listEntryNoneTemplate
@@ -660,13 +662,14 @@
         return (self.listTemplate.format(**{'Entries': classesList}),
                 ''.join(classes))
         
-    def __genRbModulesClassesListSection(self, names, dict, moduleName):
+    def __genRbModulesClassesListSection(self, names, sectionDict, moduleName):
         """
         Private method to generate the classes list section of a Ruby module.
         
         @param names The names to appear in the list. (list of strings)
-        @param dict A dictionary containing all relevant information.
-        @param moduleName Name of the Ruby module containing the classes.
+        @param sectionDict dictionary containing all relevant information
+            (dict)
+        @param moduleName name of the Ruby module containing the classes
             (string)
         @return The list section. (string)
         """
@@ -674,11 +677,11 @@
         for name in names:
             lst.append(self.listEntryTemplate.format(
                 **{'Link': "{0}.{1}".format(moduleName, name),
-                   'Name': dict[name].name,
+                   'Name': sectionDict[name].name,
                    'Description':
-                    self.__getShortDescription(dict[name].description),
+                    self.__getShortDescription(sectionDict[name].description),
                    'Deprecated':
-                    self.__checkDeprecated(dict[name].description) and
+                    self.__checkDeprecated(sectionDict[name].description) and
                     self.listEntryDeprecatedTemplate or "",
                    }))
             self.keywords.append(("{0}.{1}".format(moduleName, name),

eric ide

mercurial