1211 this module. |
1211 this module. |
1212 |
1212 |
1213 @return A dictionary with inheritance hierarchies. |
1213 @return A dictionary with inheritance hierarchies. |
1214 """ |
1214 """ |
1215 hierarchy = {} |
1215 hierarchy = {} |
1216 for cls in list(list(self.classes.keys())): |
1216 for class_ in self.classes: |
1217 self.assembleHierarchy(cls, self.classes, [cls], hierarchy) |
1217 self.assembleHierarchy(class_, self.classes, [class_], hierarchy) |
1218 for mod in list(list(self.modules.keys())): |
1218 for module in self.modules: |
1219 self.assembleHierarchy(mod, self.modules, [mod], hierarchy) |
1219 self.assembleHierarchy(module, self.modules, [module], hierarchy) |
1220 return hierarchy |
1220 return hierarchy |
1221 |
1221 |
1222 def assembleHierarchy(self, name, classes, path, result): |
1222 def assembleHierarchy(self, name, classes, path, result): |
1223 """ |
1223 """ |
1224 Public method to assemble the inheritance hierarchy. |
1224 Public method to assemble the inheritance hierarchy. |
1234 @param path |
1234 @param path |
1235 @param result The resultant hierarchy |
1235 @param result The resultant hierarchy |
1236 """ |
1236 """ |
1237 rv = {} |
1237 rv = {} |
1238 if name in classes: |
1238 if name in classes: |
1239 for cls in classes[name].super: |
1239 for class_ in classes[name].super: |
1240 if cls not in classes: |
1240 if class_ not in classes: |
1241 rv[cls] = {} |
1241 rv[class_] = {} |
1242 exhausted = path + [cls] |
1242 exhausted = path + [class_] |
1243 exhausted.reverse() |
1243 exhausted.reverse() |
1244 self.addPathToHierarchy( |
1244 self.addPathToHierarchy( |
1245 exhausted, result, self.addPathToHierarchy) |
1245 exhausted, result, self.addPathToHierarchy) |
1246 else: |
1246 else: |
1247 rv[cls] = self.assembleHierarchy( |
1247 rv[class_] = self.assembleHierarchy( |
1248 cls, classes, path + [cls], result) |
1248 class_, classes, path + [class_], result) |
1249 |
1249 |
1250 if len(rv) == 0: |
1250 if len(rv) == 0: |
1251 exhausted = path |
1251 exhausted = path |
1252 exhausted.reverse() |
1252 exhausted.reverse() |
1253 self.addPathToHierarchy(exhausted, result, self.addPathToHierarchy) |
1253 self.addPathToHierarchy(exhausted, result, self.addPathToHierarchy) |