DocumentationTools/APIGenerator.py

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

eric ide

mercurial