src/eric7/DocumentationTools/ModuleDocumentor.py

branch
eric7
changeset 10373
093dcebe5ecb
parent 9653
e67609152c5e
child 10418
4573827e9815
equal deleted inserted replaced
10372:1444b4bee64b 10373:093dcebe5ecb
228 @return The globals list section. (string) 228 @return The globals list section. (string)
229 """ 229 """
230 attrNames = [] 230 attrNames = []
231 scope = class_ if class_ is not None else self.module 231 scope = class_ if class_ is not None else self.module
232 attrNames = sorted( 232 attrNames = sorted(
233 attr for attr in scope.globals.keys() if not scope.globals[attr].isSignal 233 attr for attr in scope.globals if not scope.globals[attr].isSignal
234 ) 234 )
235 s = ( 235 s = (
236 "".join( 236 "".join(
237 [ 237 [
238 TemplatesListsStyleCSS.listEntrySimpleTemplate.format( 238 TemplatesListsStyleCSS.listEntrySimpleTemplate.format(
251 Private method to generate the section listing all classes of the 251 Private method to generate the section listing all classes of the
252 module. 252 module.
253 253
254 @return The classes list section. (string) 254 @return The classes list section. (string)
255 """ 255 """
256 names = sorted(self.module.classes.keys()) 256 names = sorted(self.module.classes)
257 if names: 257 if names:
258 self.empty = False 258 self.empty = False
259 s = self.__genListSection(names, self.module.classes) 259 s = self.__genListSection(names, self.module.classes)
260 else: 260 else:
261 s = TemplatesListsStyleCSS.listEntryNoneTemplate 261 s = TemplatesListsStyleCSS.listEntryNoneTemplate
266 Private method to generate the section listing all modules of the file 266 Private method to generate the section listing all modules of the file
267 (Ruby only). 267 (Ruby only).
268 268
269 @return The modules list section. (string) 269 @return The modules list section. (string)
270 """ 270 """
271 names = sorted(self.module.modules.keys()) 271 names = sorted(self.module.modules)
272 if names: 272 if names:
273 self.empty = False 273 self.empty = False
274 s = self.__genListSection(names, self.module.modules) 274 s = self.__genListSection(names, self.module.modules)
275 else: 275 else:
276 s = TemplatesListsStyleCSS.listEntryNoneTemplate 276 s = TemplatesListsStyleCSS.listEntryNoneTemplate
281 Private method to generate the section listing all functions of the 281 Private method to generate the section listing all functions of the
282 module. 282 module.
283 283
284 @return The functions list section. (string) 284 @return The functions list section. (string)
285 """ 285 """
286 names = sorted(self.module.functions.keys()) 286 names = sorted(self.module.functions)
287 if names: 287 if names:
288 self.empty = False 288 self.empty = False
289 s = self.__genListSection(names, self.module.functions) 289 s = self.__genListSection(names, self.module.functions)
290 else: 290 else:
291 s = TemplatesListsStyleCSS.listEntryNoneTemplate 291 s = TemplatesListsStyleCSS.listEntryNoneTemplate
296 Private method to generate the document section with details about 296 Private method to generate the document section with details about
297 classes. 297 classes.
298 298
299 @return The classes details section. (string) 299 @return The classes details section. (string)
300 """ 300 """
301 classNames = sorted(self.module.classes.keys()) 301 classNames = sorted(self.module.classes)
302 classes = [] 302 classes = []
303 for className in classNames: 303 for className in classNames:
304 _class = self.module.classes[className] 304 _class = self.module.classes[className]
305 supers = _class.super 305 supers = _class.super
306 supers = ", ".join(supers) if len(supers) > 0 else "None" 306 supers = ", ".join(supers) if len(supers) > 0 else "None"
419 @return method list and method details section (tuple of two string) 419 @return method list and method details section (tuple of two string)
420 """ 420 """
421 methList = [] 421 methList = []
422 methBodies = [] 422 methBodies = []
423 methods = sorted( 423 methods = sorted(
424 k for k in obj.methods.keys() if obj.methods[k].modifier == modifierFilter 424 k for k in obj.methods if obj.methods[k].modifier == modifierFilter
425 ) 425 )
426 if "__init__" in methods: 426 if "__init__" in methods:
427 methods.remove("__init__") 427 methods.remove("__init__")
428 try: 428 try:
429 methBody = TemplatesListsStyleCSS.constructorTemplate.format( 429 methBody = TemplatesListsStyleCSS.constructorTemplate.format(
499 Private method to generate the document section with details about 499 Private method to generate the document section with details about
500 Ruby modules. 500 Ruby modules.
501 501
502 @return The Ruby modules details section. (string) 502 @return The Ruby modules details section. (string)
503 """ 503 """
504 rbModulesNames = sorted(self.module.modules.keys()) 504 rbModulesNames = sorted(self.module.modules)
505 rbModules = [] 505 rbModules = []
506 for rbModuleName in rbModulesNames: 506 for rbModuleName in rbModulesNames:
507 rbModule = self.module.modules[rbModuleName] 507 rbModule = self.module.modules[rbModuleName]
508 globalsList = self.__genGlobalsListSection(rbModule) 508 globalsList = self.__genGlobalsListSection(rbModule)
509 methList, methBodies = self.__genMethodSection( 509 methList, methBodies = self.__genMethodSection(
549 @param obj Reference to the object being formatted. 549 @param obj Reference to the object being formatted.
550 @param modName Name of the Ruby module containing the classes. (string) 550 @param modName Name of the Ruby module containing the classes. (string)
551 @return The classes list and classes details section. 551 @return The classes list and classes details section.
552 (tuple of two string) 552 (tuple of two string)
553 """ 553 """
554 classNames = sorted(obj.classes.keys()) 554 classNames = sorted(obj.classes)
555 classes = [] 555 classes = []
556 for className in classNames: 556 for className in classNames:
557 _class = obj.classes[className] 557 _class = obj.classes[className]
558 supers = _class.super 558 supers = _class.super
559 supers = ", ".join(supers) if len(supers) > 0 else "None" 559 supers = ", ".join(supers) if len(supers) > 0 else "None"
639 functions. 639 functions.
640 640
641 @return The functions details section. (string) 641 @return The functions details section. (string)
642 """ 642 """
643 funcBodies = [] 643 funcBodies = []
644 funcNames = sorted(self.module.functions.keys()) 644 funcNames = sorted(self.module.functions)
645 for funcName in funcNames: 645 for funcName in funcNames:
646 try: 646 try:
647 funcBody = TemplatesListsStyleCSS.functionTemplate.format( 647 funcBody = TemplatesListsStyleCSS.functionTemplate.format(
648 **{ 648 **{
649 "Anchor": funcName, 649 "Anchor": funcName,
763 list section. 763 list section.
764 @param template The template to be used for the list. (string) 764 @param template The template to be used for the list. (string)
765 @return The list section. (string) 765 @return The list section. (string)
766 """ 766 """
767 lst = [] 767 lst = []
768 keys = sorted(dictionary.keys()) 768 keys = sorted(dictionary)
769 for key in keys: 769 for key in keys:
770 lst.append( 770 lst.append(
771 template.format( 771 template.format(
772 **{ 772 **{
773 "Name": key, 773 "Name": key,

eric ide

mercurial