DocumentationTools/APIGenerator.py

branch
5_1_x
changeset 1344
54c50e65173f
parent 791
9ec2ac20e54e
child 1510
e75ecf2bd9dd
equal deleted inserted replaced
1340:142ad6decc3a 1344:54c50e65173f
22 """ 22 """
23 self.module = module 23 self.module = module
24 24
25 def genAPI(self, newStyle, basePackage, includePrivate): 25 def genAPI(self, newStyle, basePackage, includePrivate):
26 """ 26 """
27 Method to generate the source code documentation. 27 Public method to generate the API information.
28 28
29 @param newStyle flag indicating the api generation for QScintilla 1.7 and 29 @param newStyle flag indicating the api generation for QScintilla 1.7 and
30 newer (boolean) (ignored) 30 newer (boolean) (ignored)
31 @param basePackage name of the base package (string) 31 @param basePackage name of the base package (string)
32 @param includePrivate flag indicating to include 32 @param includePrivate flag indicating to include
33 private methods/functions (boolean) 33 private methods/functions (boolean)
34 @return The API information. (string) 34 @return API information (list of strings)
35 """ 35 """
36 self.includePrivate = includePrivate 36 self.includePrivate = includePrivate
37 modulePath = self.module.name.split('.') 37 modulePath = self.module.name.split('.')
38 if modulePath[-1] == '__init__': 38 if modulePath[-1] == '__init__':
39 del modulePath[-1] 39 del modulePath[-1]
43 self.api = [] 43 self.api = []
44 self.__addGlobalsAPI() 44 self.__addGlobalsAPI()
45 self.__addClassesAPI() 45 self.__addClassesAPI()
46 self.__addFunctionsAPI() 46 self.__addFunctionsAPI()
47 return self.api 47 return self.api
48
49 def genBases(self, includePrivate):
50 """
51 Public method to generate the base classes information.
52
53 @param includePrivate flag indicating to include private classes (boolean)
54 @return base classes information (dictionary of list of strings)
55 """
56 bases = {}
57 self.includePrivate = includePrivate
58 classNames = sorted(list(self.module.classes.keys()))
59 for className in classNames:
60 if not self.__isPrivate(self.module.classes[className]):
61 if className not in bases:
62 bases[className] = [
63 b for b in self.module.classes[className].super
64 if b != "object"]
65 return bases
48 66
49 def __isPrivate(self, obj): 67 def __isPrivate(self, obj):
50 """ 68 """
51 Private method to check, if an object is considered private. 69 Private method to check, if an object is considered private.
52 70

eric ide

mercurial