eric6/DocumentationTools/ModuleDocumentor.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 8043
0acf98cd089a
permissions
-rw-r--r--

Updated copyright for 2021.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the builtin documentation generator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 The different parts of the module document are assembled from the parsed
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 Python file. The appearance is determined by several templates defined within
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 this module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import sys
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import re
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from Utilities import html_uencode
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
18 from Utilities.ModuleParser import RB_SOURCE, Function
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
20 _signal = re.compile(
4830
f609a22f43bd Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4667
diff changeset
21 r"""
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
22 ^@signal [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 (?P<SignalName1>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 [a-zA-Z_] \w* [ \t]* \( [^)]* \)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 [ \t]* (?P<SignalDescription1> .*)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 |
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
28 ^@signal [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 (?P<SignalName2>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 [a-zA-Z_] \w*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 [ \t]+ (?P<SignalDescription2> .*)
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
33 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
35 _event = re.compile(
4830
f609a22f43bd Fixed a few code style issues detected by the updated pep8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4667
diff changeset
36 r"""
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
37 ^@event [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 (?P<EventName1>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 [a-zA-Z_] \w* [ \t]* \( [^)]* \)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 [ \t]* (?P<EventDescription1> .*)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 |
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
43 ^@event [ \t]+
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 (?P<EventName2>
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 [a-zA-Z_] \w*
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 [ \t]+ (?P<EventDescription2> .*)
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
48 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
50
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 class TagError(Exception):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Exception class raised, if an invalid documentation tag was found.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
55 pass
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
57
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 class ModuleDocument(object):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 Class implementing the builtin documentation generator.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
62 def __init__(self, module, colors, stylesheet=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 @param module the information of the parsed Python file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 @param colors dictionary specifying the various colors for the output
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 (dictionary of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 @param stylesheet the style to be used for the generated pages (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.module = module
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.empty = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.stylesheet = stylesheet
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 if self.stylesheet:
2401
4f428de32b69 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
77 from . import TemplatesListsStyleCSS
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.headerTemplate = TemplatesListsStyleCSS.headerTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.footerTemplate = TemplatesListsStyleCSS.footerTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.moduleTemplate = TemplatesListsStyleCSS.moduleTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.rbFileTemplate = TemplatesListsStyleCSS.rbFileTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 self.classTemplate = TemplatesListsStyleCSS.classTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.methodTemplate = TemplatesListsStyleCSS.methodTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
84 self.constructorTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
85 TemplatesListsStyleCSS.constructorTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.rbModuleTemplate = TemplatesListsStyleCSS.rbModuleTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
87 self.rbModulesClassTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
88 TemplatesListsStyleCSS.rbModulesClassTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.functionTemplate = TemplatesListsStyleCSS.functionTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 self.listTemplate = TemplatesListsStyleCSS.listTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.listEntryTemplate = TemplatesListsStyleCSS.listEntryTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
92 self.listEntryNoneTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
93 TemplatesListsStyleCSS.listEntryNoneTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
94 self.listEntryDeprecatedTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
95 TemplatesListsStyleCSS.listEntryDeprecatedTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
96 self.listEntrySimpleTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
97 TemplatesListsStyleCSS.listEntrySimpleTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.paragraphTemplate = TemplatesListsStyleCSS.paragraphTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
99 self.parametersListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
100 TemplatesListsStyleCSS.parametersListTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
101 self.parameterTypesListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
102 TemplatesListsStyleCSS.parameterTypesListEntryTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
103 self.parametersListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
104 TemplatesListsStyleCSS.parametersListEntryTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.returnsTemplate = TemplatesListsStyleCSS.returnsTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
106 self.returnTypesTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
107 TemplatesListsStyleCSS.returnTypesTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
108 self.exceptionsListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
109 TemplatesListsStyleCSS.exceptionsListTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
110 self.exceptionsListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
111 TemplatesListsStyleCSS.exceptionsListEntryTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
112 self.signalsListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
113 TemplatesListsStyleCSS.signalsListTemplate)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
114 self.signalsListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
115 TemplatesListsStyleCSS.signalsListEntryTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.eventsListTemplate = TemplatesListsStyleCSS.eventsListTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
117 self.eventsListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
118 TemplatesListsStyleCSS.eventsListEntryTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 self.deprecatedTemplate = TemplatesListsStyleCSS.deprecatedTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self.authorInfoTemplate = TemplatesListsStyleCSS.authorInfoTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.seeListTemplate = TemplatesListsStyleCSS.seeListTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
122 self.seeListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
123 TemplatesListsStyleCSS.seeListEntryTemplate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.seeLinkTemplate = TemplatesListsStyleCSS.seeLinkTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.sinceInfoTemplate = TemplatesListsStyleCSS.sinceInfoTemplate
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 else:
2401
4f428de32b69 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
127 from . import TemplatesListsStyle
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
128 self.headerTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
129 TemplatesListsStyle.headerTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
130 self.footerTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
131 TemplatesListsStyle.footerTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
132 self.moduleTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
133 TemplatesListsStyle.moduleTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 self.rbFileTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
135 TemplatesListsStyle.rbFileTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
136 self.classTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
137 TemplatesListsStyle.classTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
138 self.methodTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
139 TemplatesListsStyle.methodTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
140 self.constructorTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
141 TemplatesListsStyle.constructorTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
142 self.rbModuleTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
143 TemplatesListsStyle.rbModuleTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
144 self.rbModulesClassTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
145 TemplatesListsStyle.rbModulesClassTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
146 self.functionTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
147 TemplatesListsStyle.functionTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
148 self.listTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
149 TemplatesListsStyle.listTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
150 self.listEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
151 TemplatesListsStyle.listEntryTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
152 self.listEntryNoneTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
153 TemplatesListsStyle.listEntryNoneTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
154 self.listEntryDeprecatedTemplate = (
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
155 TemplatesListsStyle.listEntryDeprecatedTemplate.format(
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
156 **colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
157 self.listEntrySimpleTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
158 TemplatesListsStyle.listEntrySimpleTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
159 self.paragraphTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
160 TemplatesListsStyle.paragraphTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
161 self.parametersListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
162 TemplatesListsStyle.parametersListTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
163 self.parametersListEntryTemplate = (
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
164 TemplatesListsStyle.parametersListEntryTemplate.format(
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
165 **colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
166 self.parameterTypesListEntryTemplate = (
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
167 TemplatesListsStyle.parameterTypesListEntryTemplate.format(
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
168 **colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
169 self.returnsTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
170 TemplatesListsStyle.returnsTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
171 self.returnTypesTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
172 TemplatesListsStyle.returnTypesTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
173 self.exceptionsListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
174 TemplatesListsStyle.exceptionsListTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
175 self.exceptionsListEntryTemplate = (
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
176 TemplatesListsStyle.exceptionsListEntryTemplate.format(
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
177 **colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
178 self.signalsListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
179 TemplatesListsStyle.signalsListTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
180 self.signalsListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
181 TemplatesListsStyle.signalsListEntryTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
182 self.eventsListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
183 TemplatesListsStyle.eventsListTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
184 self.eventsListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
185 TemplatesListsStyle.eventsListEntryTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
186 self.deprecatedTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
187 TemplatesListsStyle.deprecatedTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
188 self.authorInfoTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
189 TemplatesListsStyle.authorInfoTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
190 self.seeListTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
191 TemplatesListsStyle.seeListTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
192 self.seeListEntryTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
193 TemplatesListsStyle.seeListEntryTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
194 self.seeLinkTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
195 TemplatesListsStyle.seeLinkTemplate.format(**colors))
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
196 self.sinceInfoTemplate = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
197 TemplatesListsStyle.sinceInfoTemplate.format(**colors))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
199 self.keywords = []
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
200 # list of tuples containing the name (string) and
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
201 # the ref (string). The ref is without the filename part.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 self.generated = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 def isEmpty(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
206 Public method to determine, if the module contains any classes or
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
207 functions.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 @return Flag indicating an empty module (i.e. __init__.py without
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 any contents)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 return self.empty
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 def name(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 Public method used to get the module name.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 @return The name of the module. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 return self.module.name
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 def description(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 Public method used to get the description of the module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 @return The description of the module. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 return self.__formatDescription(self.module.description)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 def shortDescription(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 Public method used to get the short description of the module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 The short description is just the first line of the modules
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 @return The short description of the module. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 return self.__getShortDescription(self.module.description)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 def genDocument(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 Public method to generate the source code documentation.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 @return The source code documentation. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 """
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
247 doc = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
248 self.headerTemplate.format(
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
249 **{'Title': self.module.name,
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
250 'Style': self.stylesheet}
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
251 ) +
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
252 self.__genModuleSection() +
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
253 self.footerTemplate
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
254 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 self.generated = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 return doc
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 def __genModuleSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 Private method to generate the body of the document.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 @return The body of the document. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 globalsList = self.__genGlobalsListSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 classList = self.__genClassListSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 functionList = self.__genFunctionListSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 if self.module.type == RB_SOURCE:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 rbModulesList = self.__genRbModulesListSection()
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
270 modBody = self.rbFileTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
271 **{'Module': self.module.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
272 'ModuleDescription':
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.__formatDescription(self.module.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
274 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
275 'ClassList': classList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
276 'RbModulesList': rbModulesList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
277 'FunctionList': functionList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
278 })
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 else:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
280 modBody = self.moduleTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
281 **{'Module': self.module.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
282 'ModuleDescription':
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 self.__formatDescription(self.module.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
284 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
285 'ClassList': classList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
286 'FunctionList': functionList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
287 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
288 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
289 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
290 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
291 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
292 "Error in tags of description of module {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
293 self.module.name))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
294 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 return ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 classesSection = self.__genClassesSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 functionsSection = self.__genFunctionsSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 if self.module.type == RB_SOURCE:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 rbModulesSection = self.__genRbModulesSection()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 rbModulesSection = ""
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
303 return "{0}{1}{2}{3}".format(
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
304 modBody, classesSection, rbModulesSection, functionsSection)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
306 def __genListSection(self, names, sectionDict, kwSuffix=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 Private method to generate a list section of the document.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 @param names The names to appear in the list. (list of strings)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
311 @param sectionDict dictionary containing all relevant information
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
312 (dict)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 @param kwSuffix suffix to be used for the QtHelp keywords (string)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
314 @return list section (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 for name in names:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
318 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
319 **{'Link': "{0}".format(name),
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
320 'Name': sectionDict[name].name,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
321 'Description':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
322 self.__getShortDescription(sectionDict[name].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
323 'Deprecated':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
324 self.__checkDeprecated(sectionDict[name].description) and
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 self.listEntryDeprecatedTemplate or "",
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
326 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 if kwSuffix:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
328 n = "{0} ({1})".format(name, kwSuffix)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 else:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
330 n = "{0}".format(name)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
331 self.keywords.append((n, "#{0}".format(name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
334 def __genGlobalsListSection(self, class_=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 Private method to generate the section listing all global attributes of
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 the module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 @param class_ reference to a class object (Class)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 @return The globals list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 """
766
0940de08fa75 Modified module parser to flag PyQt signal definitions and the module documentor to exclude these from the list of attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
342 attrNames = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 if class_ is not None:
766
0940de08fa75 Modified module parser to flag PyQt signal definitions and the module documentor to exclude these from the list of attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
344 scope = class_
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 else:
766
0940de08fa75 Modified module parser to flag PyQt signal definitions and the module documentor to exclude these from the list of attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
346 scope = self.module
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
347 attrNames = sorted(attr for attr in scope.globals.keys()
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
348 if not scope.globals[attr].isSignal)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 if attrNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 s = ''.join(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
351 [self.listEntrySimpleTemplate.format(**{'Name': name})
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
352 for name in attrNames])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
355 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 def __genClassListSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
359 Private method to generate the section listing all classes of the
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
360 module.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 @return The classes list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
364 names = sorted(list(self.module.classes.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 if names:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 self.empty = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 s = self.__genListSection(names, self.module.classes)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
370 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 def __genRbModulesListSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
374 Private method to generate the section listing all modules of the file
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 (Ruby only).
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 @return The modules list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
379 names = sorted(list(self.module.modules.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 if names:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 self.empty = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 s = self.__genListSection(names, self.module.modules)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
385 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 def __genFunctionListSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
389 Private method to generate the section listing all functions of the
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
390 module.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 @return The functions list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
394 names = sorted(list(self.module.functions.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 if names:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 self.empty = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 s = self.__genListSection(names, self.module.functions)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 s = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
400 return self.listTemplate.format(**{'Entries': s})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 def __genClassesSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
404 Private method to generate the document section with details about
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
405 classes.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 @return The classes details section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
409 classNames = sorted(list(self.module.classes.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 classes = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 for className in classNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 _class = self.module.classes[className]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 supers = _class.super
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 if len(supers) > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 supers = ', '.join(supers)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 supers = 'None'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 globalsList = self.__genGlobalsListSection(_class)
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
420 classMethList, classMethBodies = self.__genMethodSection(
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
421 _class, className, Function.Class)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
422 methList, methBodies = self.__genMethodSection(
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
423 _class, className, Function.General)
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
424 staticMethList, staticMethBodies = self.__genMethodSection(
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
425 _class, className, Function.Static)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
428 clsBody = self.classTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
429 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
430 'Class': _class.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
431 'ClassSuper': supers,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
432 'ClassDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
433 self.__formatDescription(_class.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
434 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
435 'ClassMethodList': classMethList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
436 'MethodList': methList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
437 'StaticMethodList': staticMethList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
438 'MethodDetails':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
439 classMethBodies + methBodies + staticMethBodies,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
440 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
441 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
442 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
443 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
444 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
445 "Error in tags of description of class {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
446 className))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
447 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 clsBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 classes.append(clsBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 return ''.join(classes)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
454 def __genMethodsListSection(self, names, sectionDict, className, clsName,
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
455 includeInit=True):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 Private method to generate the methods list section of a class.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
459 @param names names to appear in the list (list of strings)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
460 @param sectionDict dictionary containing all relevant information
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
461 (dict)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
462 @param className class name containing the names
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
463 @param clsName visible class name containing the names
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
464 @param includeInit flag indicating to include the __init__ method
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
465 (boolean)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
466 @return methods list section (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 lst = []
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
469 if includeInit:
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
470 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
471 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
472 **{'Link': "{0}.{1}".format(className, '__init__'),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
473 'Name': clsName,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
474 'Description': self.__getShortDescription(
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
475 sectionDict['__init__'].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
476 'Deprecated': self.__checkDeprecated(
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
477 sectionDict['__init__'].description) and
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
478 self.listEntryDeprecatedTemplate or "",
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
479 }))
2991
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2989
diff changeset
480 self.keywords.append(
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2989
diff changeset
481 ("{0} (Constructor)".format(className),
226481ff40d1 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2989
diff changeset
482 "#{0}.{1}".format(className, '__init__')))
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
483 except KeyError:
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
484 pass
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
485
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 for name in names:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
487 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
488 **{'Link': "{0}.{1}".format(className, name),
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
489 'Name': sectionDict[name].name,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
490 'Description':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
491 self.__getShortDescription(sectionDict[name].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
492 'Deprecated':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
493 self.__checkDeprecated(sectionDict[name].description) and
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
494 self.listEntryDeprecatedTemplate or "",
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
495 }))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
496 self.keywords.append(("{0}.{1}".format(className, name),
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
497 "#{0}.{1}".format(className, name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
500 def __genMethodSection(self, obj, className, modifierFilter):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 Private method to generate the method details section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
504 @param obj reference to the object being formatted
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
505 @param className name of the class containing the method (string)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
506 @param modifierFilter filter value designating the method types
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
507 @return method list and method details section (tuple of two string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
509 methList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
510 methBodies = []
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
511 methods = sorted(k for k in obj.methods.keys()
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
512 if obj.methods[k].modifier == modifierFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513 if '__init__' in methods:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 methods.remove('__init__')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
516 methBody = self.constructorTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
517 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
518 'Class': obj.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
519 'Method': '__init__',
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
520 'MethodDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
521 self.__formatDescription(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
522 obj.methods['__init__'].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
523 'Params':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
524 ', '.join(obj.methods['__init__'].parameters[1:]),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
525 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
526 except TagError as e:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
527 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
528 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
529 sys.stderr.write(
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
530 "Error in tags of description of method {0}.{1}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
531 className, '__init__'))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
532 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533 methBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 methBodies.append(methBody)
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
535
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
536 if modifierFilter == Function.Class:
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
537 methodClassifier = " (class method)"
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
538 elif modifierFilter == Function.Static:
1227
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
539 methodClassifier = " (static)"
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
540 else:
c5db073a124f Added support for class attributes, class methods and static methods to the class browsers and the source documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
541 methodClassifier = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 for method in methods:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
544 methBody = self.methodTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
545 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
546 'Class': obj.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
547 'Method': obj.methods[method].name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
548 'MethodClassifier': methodClassifier,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
549 'MethodDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
550 self.__formatDescription(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
551 obj.methods[method].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
552 'Params': ', '.join(obj.methods[method].parameters[1:]),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
553 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
554 except TagError as e:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
555 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
556 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
557 sys.stderr.write(
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
558 "Error in tags of description of method {0}.{1}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
559 className, method))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
560 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 methBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 methBodies.append(methBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563
3021
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
564 methList = self.__genMethodsListSection(
801289962f4e Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2991
diff changeset
565 methods, obj.methods, className, obj.name,
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
566 includeInit=modifierFilter == Function.General)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 if not methList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 methList = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
570 return (self.listTemplate.format(**{'Entries': methList}),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
571 ''.join(methBodies))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 def __genRbModulesSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
575 Private method to generate the document section with details about
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
576 Ruby modules.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
577
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 @return The Ruby modules details section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
580 rbModulesNames = sorted(list(self.module.modules.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 rbModules = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 for rbModuleName in rbModulesNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 rbModule = self.module.modules[rbModuleName]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 globalsList = self.__genGlobalsListSection(rbModule)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
585 methList, methBodies = self.__genMethodSection(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
586 rbModule, rbModuleName, Function.General)
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
587 classList, classBodies = self.__genRbModulesClassesSection(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
588 rbModule, rbModuleName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
591 rbmBody = self.rbModuleTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
592 **{'Anchor': rbModuleName,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
593 'Module': rbModule.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
594 'ModuleDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
595 self.__formatDescription(rbModule.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
596 'GlobalsList': globalsList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
597 'ClassesList': classList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
598 'ClassesDetails': classBodies,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
599 'FunctionsList': methList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
600 'FunctionsDetails': methBodies,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
601 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
602 except TagError as e:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
603 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
604 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
605 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
606 "Error in tags of description of Ruby module {0}.\n"
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
607 .format(rbModuleName))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
608 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
609 rbmBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 rbModules.append(rbmBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 return ''.join(rbModules)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 def __genRbModulesClassesSection(self, obj, modName):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 Private method to generate the Ruby module classes details section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
618
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
619 @param obj Reference to the object being formatted.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 @param modName Name of the Ruby module containing the classes. (string)
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
621 @return The classes list and classes details section.
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
622 (tuple of two string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 """
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
624 classNames = sorted(list(obj.classes.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 classes = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 for className in classNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 _class = obj.classes[className]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 supers = _class.super
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629 if len(supers) > 0:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 supers = ', '.join(supers)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 supers = 'None'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
634 methList, methBodies = self.__genMethodSection(
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
635 _class, className, Function.General)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
638 clsBody = self.rbModulesClassTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
639 **{'Anchor': className,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
640 'Class': _class.name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
641 'ClassSuper': supers,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
642 'ClassDescription':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
643 self.__formatDescription(_class.description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
644 'MethodList': methList,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
645 'MethodDetails': methBodies,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
646 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
647 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
648 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
649 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
650 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
651 "Error in tags of description of class {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
652 className))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
653 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 clsBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 classes.append(clsBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
658 classesList = self.__genRbModulesClassesListSection(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
659 classNames, obj.classes, modName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 if not classesList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 classesList = self.listEntryNoneTemplate
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
663 return (self.listTemplate.format(**{'Entries': classesList}),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
664 ''.join(classes))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
666 def __genRbModulesClassesListSection(self, names, sectionDict, moduleName):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 Private method to generate the classes list section of a Ruby module.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 @param names The names to appear in the list. (list of strings)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
671 @param sectionDict dictionary containing all relevant information
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
672 (dict)
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
673 @param moduleName name of the Ruby module containing the classes
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
674 (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 @return The list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 for name in names:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
679 lst.append(self.listEntryTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
680 **{'Link': "{0}.{1}".format(moduleName, name),
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
681 'Name': sectionDict[name].name,
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
682 'Description':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
683 self.__getShortDescription(sectionDict[name].description),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
684 'Deprecated':
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
685 self.__checkDeprecated(sectionDict[name].description) and
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
686 self.listEntryDeprecatedTemplate or "",
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
687 }))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
688 self.keywords.append(("{0}.{1}".format(moduleName, name),
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
689 "#{0}.{1}".format(moduleName, name)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692 def __genFunctionsSection(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
694 Private method to generate the document section with details about
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
695 functions.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 @return The functions details section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 funcBodies = []
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
700 funcNames = sorted(list(self.module.functions.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 for funcName in funcNames:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702 try:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
703 funcBody = self.functionTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
704 **{'Anchor': funcName,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
705 'Function': self.module.functions[funcName].name,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
706 'FunctionDescription': self.__formatDescription(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
707 self.module.functions[funcName].description),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
708 'Params':
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
709 ', '.join(self.module.functions[funcName].parameters),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
710 })
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
711 except TagError as e:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
712 sys.stderr.write(
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
713 "Error processing {0}.\n".format(self.module.file))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
714 sys.stderr.write(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
715 "Error in tags of description of function {0}.\n".format(
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
716 funcName))
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
717 sys.stderr.write("{0}\n".format(e))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 funcBody = ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
720 funcBodies.append(funcBody)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 return ''.join(funcBodies)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 def __getShortDescription(self, desc):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
725 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
726 Private method to determine the short description of an object.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
727
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
728 The short description is just the first non empty line of the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729 documentation string.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
730
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
731 @param desc The documentation string. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
732 @return The short description. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
733 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734 dlist = desc.splitlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
735 sdlist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
736 descfound = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
737 for desc in dlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
738 desc = desc.strip()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
739 if desc:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
740 descfound = 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
741 dotpos = desc.find('.')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
742 if dotpos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
743 sdlist.append(desc.strip())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
744 else:
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
745 while (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
746 dotpos + 1 < len(desc) and
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
747 not desc[dotpos + 1].isspace()
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
748 ):
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
749 # don't recognize '.' inside a number or word as
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
750 # stop condition
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
751 dotpos = desc.find('.', dotpos + 1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
752 if dotpos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
753 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
754 if dotpos == -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755 sdlist.append(desc.strip())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
756 else:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
757 sdlist.append(desc[:dotpos + 1].strip())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
758 break # break if a '.' is found
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 if descfound:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 break # break if an empty line is found
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
762 if sdlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
763 return html_uencode(' '.join(sdlist))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 return ''
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 def __checkDeprecated(self, descr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
769 Private method to check, if the object to be documented contains a
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 deprecated flag.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
772 @param descr documentation string (string)
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
773 @return flag indicating the deprecation status (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 dlist = descr.splitlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 for desc in dlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 desc = desc.strip()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 if desc.startswith("@deprecated"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 return True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 return False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 def __genParagraphs(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 Private method to assemble the descriptive paragraphs of a docstring.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 A paragraph is made up of a number of consecutive lines without
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 an intermediate empty line. Empty lines are treated as a paragraph
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 delimiter.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 @param lines A list of individual lines. (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 @return Ready formatted paragraphs. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 linelist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 for line in lines:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 if line.strip():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 if line == '.':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 linelist.append("")
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 linelist.append(html_uencode(line))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 else:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
802 lst.append(self.paragraphTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
803 **{'Lines': '\n'.join(linelist)}))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
804 linelist = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805 if linelist:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
806 lst.append(self.paragraphTemplate.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
807 **{'Lines': '\n'.join(linelist)}))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 def __genDescriptionListSection(self, dictionary, template):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 Private method to generate the list section of a description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 @param dictionary Dictionary containing the info for the
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 list section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 @param template The template to be used for the list. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
817 @return The list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 lst = []
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
820 keys = sorted(list(dictionary.keys()))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821 for key in keys:
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
822 lst.append(template.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
823 **{'Name': key,
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
824 'Description': html_uencode('\n'.join(dictionary[key])),
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
825 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
827
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
828 def __genParamDescriptionListSection(self, _list):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830 Private method to generate the list section of a description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
832 @param _list list containing the info for the parameter description
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
833 list section (list of lists with three elements)
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
834 @return formatted list section (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 lst = []
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
837 for name, type_, lines in _list:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
838 if type_:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
839 lst.append(self.parameterTypesListEntryTemplate.format(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
840 **{'Name': name,
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
841 'Type': type_,
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
842 'Description': html_uencode('\n'.join(lines)),
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
843 }))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
844 else:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
845 lst.append(self.parametersListEntryTemplate.format(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
846 **{'Name': name,
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
847 'Description': html_uencode('\n'.join(lines)),
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
848 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
849 return ''.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 def __formatCrossReferenceEntry(self, entry):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
852 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853 Private method to format a cross reference entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 This cross reference entry looks like "package.module#member label".
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857 @param entry the entry to be formatted (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
858 @return formatted entry (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
859 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
860 if entry.startswith('"'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
861 return entry
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 elif entry.startswith('<'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 entry = entry[3:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 reference, label = entry.split(None, 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 except ValueError:
96
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
868 reference = entry
9624a110667d Started to clean up the code supported by py3flakes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
869 label = entry
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
871 path, anchor = reference.split('#', 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
872 except ValueError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 path = reference
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 anchor = ''
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
875 reference = path and "{0}.html".format(path) or ''
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876 if anchor:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
877 reference = "{0}#{1}".format(reference, anchor)
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
878 entry = 'href="{0}">{1}</a>'.format(reference, label)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
880 return self.seeLinkTemplate.format(**{'Link': entry})
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
881
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
882 def __genSeeListSection(self, _list, template):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
883 """
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
884 Private method to generate the "see also" list section of a
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
885 description.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
886
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 @param _list List containing the info for the section.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 @param template The template to be used for the list. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889 @return The list section. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 lst = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 for seeEntry in _list:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
893 seeEntryString = ''.join(seeEntry)
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
894 lst.append(template.format(
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
895 **{'Link': html_uencode(self.__formatCrossReferenceEntry(
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
896 seeEntryString)),
3033
58fe260e7469 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3021
diff changeset
897 }))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 return '\n'.join(lst)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900 def __processInlineTags(self, desc):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 Private method to process inline tags.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
904 @param desc One line of the description (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
905 @return processed line with inline tags expanded (string)
2953
703452a2876f Started correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2401
diff changeset
906 @exception TagError raised to indicate an invalid tag
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
907 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
908 start = desc.find('{@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
909 while start != -1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
910 stop = desc.find('}', start + 2)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 if stop == -1:
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
912 raise TagError("Unterminated inline tag.\n{0}".format(desc))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 tagText = desc[start + 1:stop]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 if tagText.startswith('@link'):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 parts = tagText.split(None, 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
918 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
919 "Wrong format in inline tag {0}.\n{1}".format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
920 parts[0], desc))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 formattedTag = self.__formatCrossReferenceEntry(parts[1])
406
eacf81fad150 Started converting the string formatting stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 96
diff changeset
923 desc = desc.replace("{{{0}}}".format(tagText), formattedTag)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925 tag = tagText.split(None, 1)[0]
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
926 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
927 "Unknown inline tag encountered, {0}.\n{1}".format(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
928 tag, desc))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
929
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 start = desc.find('{@')
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
931
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 return desc
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 def __formatDescription(self, descr):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
935 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 Private method to format the contents of the documentation string.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 @param descr The contents of the documentation string. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 @exception TagError A tag doesn't have the correct number
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 of arguments.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 @return The formated contents of the documentation string. (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 if not descr:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 return ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946 paragraphs = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 paramList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 returns = []
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
949 returnTypes = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 exceptionDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 signalDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 eventDict = {}
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 deprecated = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 authorInfo = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 sinceInfo = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 seeList = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957 lastItem = paragraphs
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 inTagSection = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960 dlist = descr.splitlines()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 while dlist and not dlist[0]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
962 del dlist[0]
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
963 lastTag = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 for ditem in dlist:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 ditem = self.__processInlineTags(ditem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 desc = ditem.strip()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967 if desc:
2956
615dbd8a696a Extended the module documentor by a @ireturn tag to document the intended return value (e.g. in a base class defining an interface).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
968 if desc.startswith(("@param", "@keyparam")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 inTagSection = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 parts = desc.split(None, 2)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
971 lastTag = parts[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
973 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
974 "Wrong format in {0} line.\n".format(parts[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 paramName = parts[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 if parts[0] == "@keyparam":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 paramName += '='
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
978 try:
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
979 paramList.append([paramName, "", [parts[2]]])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 except IndexError:
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
981 paramList.append([paramName, "", []])
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
982 lastItem = paramList[-1][2]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
983 elif desc.startswith("@type"):
4667
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
984 parts = desc.split(None, 1)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
985 if lastTag not in ["@param", "@keyparam"]:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
986 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
987 "{0} line must be preceded by a parameter line\n"
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
988 .format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
989 inTagSection = True
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
990 lastTag = parts[0]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
991 if len(parts) < 2:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
992 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
993 "Wrong format in {0} line.\n".format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
994 paramList[-1][1] = parts[1]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
995 elif desc.startswith("@ptype"):
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
996 inTagSection = True
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
997 parts = desc.split(None, 2)
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
998 lastTag = parts[0]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
999 if len(parts) < 3:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1000 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1001 "Wrong format in {0} line.\n".format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1002 param, type_ = parts[1:]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1003 for index in range(len(paramList)):
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1004 if paramList[index][0] == param:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1005 paramList[index][1] = type_
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1006 break
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1007 else:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1008 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1009 "Unknow parameter name '{0}' in {1} line.\n"
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1010 .format(param, parts[0]))
2956
615dbd8a696a Extended the module documentor by a @ireturn tag to document the intended return value (e.g. in a base class defining an interface).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1011 elif desc.startswith(("@return", "@ireturn")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1012 inTagSection = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1013 parts = desc.split(None, 1)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1014 lastTag = parts[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1016 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1017 "Wrong format in {0} line.\n".format(parts[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 returns = [parts[1]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 lastItem = returns
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1020 elif desc.startswith("@rtype"):
4667
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1021 parts = desc.split(None, 1)
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1022 if lastTag not in ["@return", "@ireturn"]:
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1023 raise TagError(
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1024 "{0} line must be preceded by a return line\n"
77050ebbdb20 Fixed an issue in the module documentor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
1025 .format(parts[0]))
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1026 inTagSection = True
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1027 lastTag = parts[0]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1028 if len(parts) < 2:
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1029 raise TagError(
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1030 "Wrong format in {0} line.\n".format(parts[0]))
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1031 returnTypes = [parts[1]]
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1032 lastItem = returnTypes
2956
615dbd8a696a Extended the module documentor by a @ireturn tag to document the intended return value (e.g. in a base class defining an interface).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2953
diff changeset
1033 elif desc.startswith(("@exception", "@throws", "@raise")):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1034 inTagSection = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1035 parts = desc.split(None, 2)
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1036 lastTag = parts[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1037 if len(parts) < 2:
2989
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1038 raise TagError(
7efa8b8b6903 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2956
diff changeset
1039 "Wrong format in {0} line.\n".format(parts[0]))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 excName = parts[1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1041 try:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 exceptionDict[excName] = [parts[2]]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 except IndexError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 exceptionDict[excName] = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045 lastItem = exceptionDict[excName]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 elif desc.startswith("@signal"):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047 inTagSection = True
4267
94496d77156b Added tags to describe the type of parameters (@type, @ptype) and return values (@rtype).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1048 lastTag = desc.split(None, 1)[0]
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
1049 m = _signal(desc, 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1050 if m is None:
2174
6c0e26b9df7b Fixed an error in the documentation generator.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1051 raise TagError("Wrong format in @signal line.\n")
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1052 signalName = (