src/eric7/Documentation/Source/eric7.QScintilla.DocstringGenerator.BaseDocstringGenerator.html

branch
eric7
changeset 10479
856476537696
parent 10431
64157aeb0312
child 10684
58c7f23ae1cb
equal deleted inserted replaced
10478:de9106c55c3d 10479:856476537696
5 <link rel="stylesheet" href="styles.css"> 5 <link rel="stylesheet" href="styles.css">
6 </head> 6 </head>
7 <body> 7 <body>
8 <a NAME="top" ID="top"></a> 8 <a NAME="top" ID="top"></a>
9 <h1>eric7.QScintilla.DocstringGenerator.BaseDocstringGenerator</h1> 9 <h1>eric7.QScintilla.DocstringGenerator.BaseDocstringGenerator</h1>
10
11 <p> 10 <p>
12 Module implementing a docstring generator base class. 11 Module implementing a docstring generator base class.
13 </p> 12 </p>
13
14 <h3>Global Attributes</h3> 14 <h3>Global Attributes</h3>
15 15 <table>
16 <table> 16 <tr><td>None</td></tr>
17 <tr><td>None</td></tr> 17 </table>
18 </table> 18
19 <h3>Classes</h3> 19 <h3>Classes</h3>
20 20 <table>
21 <table>
22
23 <tr> 21 <tr>
24 <td><a href="#BaseDocstringGenerator">BaseDocstringGenerator</a></td> 22 <td><a href="#BaseDocstringGenerator">BaseDocstringGenerator</a></td>
25 <td>Class implementing a docstring generator base class.</td> 23 <td>Class implementing a docstring generator base class.</td>
26 </tr> 24 </tr>
27 <tr> 25 <tr>
31 <tr> 29 <tr>
32 <td><a href="#FunctionInfo">FunctionInfo</a></td> 30 <td><a href="#FunctionInfo">FunctionInfo</a></td>
33 <td>Class implementing an object to store function information.</td> 31 <td>Class implementing an object to store function information.</td>
34 </tr> 32 </tr>
35 </table> 33 </table>
34
36 <h3>Functions</h3> 35 <h3>Functions</h3>
37 36 <table>
38 <table>
39
40 <tr> 37 <tr>
41 <td><a href="#getIndentStr">getIndentStr</a></td> 38 <td><a href="#getIndentStr">getIndentStr</a></td>
42 <td>Function to get the indentation of a text.</td> 39 <td>Function to get the indentation of a text.</td>
43 </tr> 40 </tr>
44 </table> 41 </table>
42
45 <hr /> 43 <hr />
46 <hr /> 44 <hr />
47 <a NAME="BaseDocstringGenerator" ID="BaseDocstringGenerator"></a> 45 <a NAME="BaseDocstringGenerator" ID="BaseDocstringGenerator"></a>
48 <h2>BaseDocstringGenerator</h2> 46 <h2>BaseDocstringGenerator</h2>
49
50 <p> 47 <p>
51 Class implementing a docstring generator base class. 48 Class implementing a docstring generator base class.
52 </p> 49 </p>
50
53 <h3>Derived from</h3> 51 <h3>Derived from</h3>
54 None 52 None
55 <h3>Class Attributes</h3> 53 <h3>Class Attributes</h3>
56 54 <table>
57 <table> 55 <tr><td>None</td></tr>
58 <tr><td>None</td></tr> 56 </table>
59 </table> 57
60 <h3>Class Methods</h3> 58 <h3>Class Methods</h3>
61 59 <table>
62 <table> 60 <tr><td>None</td></tr>
63 <tr><td>None</td></tr> 61 </table>
64 </table> 62
65 <h3>Methods</h3> 63 <h3>Methods</h3>
66 64 <table>
67 <table>
68
69 <tr> 65 <tr>
70 <td><a href="#BaseDocstringGenerator.__init__">BaseDocstringGenerator</a></td> 66 <td><a href="#BaseDocstringGenerator.__init__">BaseDocstringGenerator</a></td>
71 <td>Constructor</td> 67 <td>Constructor</td>
72 </tr> 68 </tr>
73 <tr> 69 <tr>
97 <tr> 93 <tr>
98 <td><a href="#BaseDocstringGenerator.isFunctionStart">isFunctionStart</a></td> 94 <td><a href="#BaseDocstringGenerator.isFunctionStart">isFunctionStart</a></td>
99 <td>Public method to test, if a text is the start of a function or method definition.</td> 95 <td>Public method to test, if a text is the start of a function or method definition.</td>
100 </tr> 96 </tr>
101 </table> 97 </table>
98
102 <h3>Static Methods</h3> 99 <h3>Static Methods</h3>
103 100 <table>
104 <table> 101 <tr><td>None</td></tr>
105 <tr><td>None</td></tr> 102 </table>
106 </table> 103
107 104
108 <a NAME="BaseDocstringGenerator.__init__" ID="BaseDocstringGenerator.__init__"></a> 105 <a NAME="BaseDocstringGenerator.__init__" ID="BaseDocstringGenerator.__init__"></a>
109 <h4>BaseDocstringGenerator (Constructor)</h4> 106 <h4>BaseDocstringGenerator (Constructor)</h4>
110 <b>BaseDocstringGenerator</b>(<i>editor</i>) 107 <b>BaseDocstringGenerator</b>(<i>editor</i>)
111
112 <p> 108 <p>
113 Constructor 109 Constructor
114 </p> 110 </p>
111
115 <dl> 112 <dl>
116 113
117 <dt><i>editor</i> (Editor)</dt> 114 <dt><i>editor</i> (Editor)</dt>
118 <dd> 115 <dd>
119 reference to the editor widget 116 reference to the editor widget
120 </dd> 117 </dd>
121 </dl> 118 </dl>
122 <a NAME="BaseDocstringGenerator._generateDocstringList" ID="BaseDocstringGenerator._generateDocstringList"></a> 119 <a NAME="BaseDocstringGenerator._generateDocstringList" ID="BaseDocstringGenerator._generateDocstringList"></a>
123 <h4>BaseDocstringGenerator._generateDocstringList</h4> 120 <h4>BaseDocstringGenerator._generateDocstringList</h4>
124 <b>_generateDocstringList</b>(<i>functionInfo, docstringType</i>) 121 <b>_generateDocstringList</b>(<i>functionInfo, docstringType</i>)
125
126 <p> 122 <p>
127 Protected method to generate type specific docstrings based on the 123 Protected method to generate type specific docstrings based on the
128 extracted function information. 124 extracted function information.
129 </p> 125 </p>
126
130 <dl> 127 <dl>
131 128
132 <dt><i>functionInfo</i> (FunctionInfo)</dt> 129 <dt><i>functionInfo</i> (FunctionInfo)</dt>
133 <dd> 130 <dd>
134 reference to the function info object 131 reference to the function info object
151 </dd> 148 </dd>
152 </dl> 149 </dl>
153 <a NAME="BaseDocstringGenerator.getDocstringType" ID="BaseDocstringGenerator.getDocstringType"></a> 150 <a NAME="BaseDocstringGenerator.getDocstringType" ID="BaseDocstringGenerator.getDocstringType"></a>
154 <h4>BaseDocstringGenerator.getDocstringType</h4> 151 <h4>BaseDocstringGenerator.getDocstringType</h4>
155 <b>getDocstringType</b>(<i></i>) 152 <b>getDocstringType</b>(<i></i>)
156
157 <p> 153 <p>
158 Public method to determine the docstring type to be generated. 154 Public method to determine the docstring type to be generated.
159 </p> 155 </p>
156
160 <dl> 157 <dl>
161 <dt>Return:</dt> 158 <dt>Return:</dt>
162 <dd> 159 <dd>
163 docstring type (one of 'ericdoc', 'numpydoc', 'googledoc', 160 docstring type (one of 'ericdoc', 'numpydoc', 'googledoc',
164 'sphinxdoc') 161 'sphinxdoc')
171 </dd> 168 </dd>
172 </dl> 169 </dl>
173 <a NAME="BaseDocstringGenerator.hasFunctionDefinition" ID="BaseDocstringGenerator.hasFunctionDefinition"></a> 170 <a NAME="BaseDocstringGenerator.hasFunctionDefinition" ID="BaseDocstringGenerator.hasFunctionDefinition"></a>
174 <h4>BaseDocstringGenerator.hasFunctionDefinition</h4> 171 <h4>BaseDocstringGenerator.hasFunctionDefinition</h4>
175 <b>hasFunctionDefinition</b>(<i>cursorPosition</i>) 172 <b>hasFunctionDefinition</b>(<i>cursorPosition</i>)
176
177 <p> 173 <p>
178 Public method to test, if the cursor is right below a function 174 Public method to test, if the cursor is right below a function
179 definition. 175 definition.
180 </p> 176 </p>
177
181 <dl> 178 <dl>
182 179
183 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> 180 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
184 <dd> 181 <dd>
185 current cursor position (line and column) 182 current cursor position (line and column)
198 </dd> 195 </dd>
199 </dl> 196 </dl>
200 <a NAME="BaseDocstringGenerator.insertDocstring" ID="BaseDocstringGenerator.insertDocstring"></a> 197 <a NAME="BaseDocstringGenerator.insertDocstring" ID="BaseDocstringGenerator.insertDocstring"></a>
201 <h4>BaseDocstringGenerator.insertDocstring</h4> 198 <h4>BaseDocstringGenerator.insertDocstring</h4>
202 <b>insertDocstring</b>(<i>cursorPosition, fromStart=True</i>) 199 <b>insertDocstring</b>(<i>cursorPosition, fromStart=True</i>)
203
204 <p> 200 <p>
205 Public method to insert a docstring for the function at the cursor 201 Public method to insert a docstring for the function at the cursor
206 position. 202 position.
207 </p> 203 </p>
204
208 <dl> 205 <dl>
209 206
210 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> 207 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
211 <dd> 208 <dd>
212 position of the cursor (line and index) 209 position of the cursor (line and index)
218 </dd> 215 </dd>
219 </dl> 216 </dl>
220 <a NAME="BaseDocstringGenerator.insertDocstringFromShortcut" ID="BaseDocstringGenerator.insertDocstringFromShortcut"></a> 217 <a NAME="BaseDocstringGenerator.insertDocstringFromShortcut" ID="BaseDocstringGenerator.insertDocstringFromShortcut"></a>
221 <h4>BaseDocstringGenerator.insertDocstringFromShortcut</h4> 218 <h4>BaseDocstringGenerator.insertDocstringFromShortcut</h4>
222 <b>insertDocstringFromShortcut</b>(<i>cursorPosition</i>) 219 <b>insertDocstringFromShortcut</b>(<i>cursorPosition</i>)
223
224 <p> 220 <p>
225 Public method to insert a docstring for the function at the cursor 221 Public method to insert a docstring for the function at the cursor
226 position initiated via a keyboard shortcut. 222 position initiated via a keyboard shortcut.
227 </p> 223 </p>
224
228 <dl> 225 <dl>
229 226
230 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> 227 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
231 <dd> 228 <dd>
232 position of the cursor (line and index) 229 position of the cursor (line and index)
233 </dd> 230 </dd>
234 </dl> 231 </dl>
235 <a NAME="BaseDocstringGenerator.isDocstringIntro" ID="BaseDocstringGenerator.isDocstringIntro"></a> 232 <a NAME="BaseDocstringGenerator.isDocstringIntro" ID="BaseDocstringGenerator.isDocstringIntro"></a>
236 <h4>BaseDocstringGenerator.isDocstringIntro</h4> 233 <h4>BaseDocstringGenerator.isDocstringIntro</h4>
237 <b>isDocstringIntro</b>(<i>cursorPosition</i>) 234 <b>isDocstringIntro</b>(<i>cursorPosition</i>)
238
239 <p> 235 <p>
240 Public function to test, if the line up to the cursor position might be 236 Public function to test, if the line up to the cursor position might be
241 introducing a docstring. 237 introducing a docstring.
242 </p> 238 </p>
239
243 <dl> 240 <dl>
244 241
245 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> 242 <dt><i>cursorPosition</i> (tuple of (int, int))</dt>
246 <dd> 243 <dd>
247 current cursor position (line and column) 244 current cursor position (line and column)
260 </dd> 257 </dd>
261 </dl> 258 </dl>
262 <a NAME="BaseDocstringGenerator.isFunctionStart" ID="BaseDocstringGenerator.isFunctionStart"></a> 259 <a NAME="BaseDocstringGenerator.isFunctionStart" ID="BaseDocstringGenerator.isFunctionStart"></a>
263 <h4>BaseDocstringGenerator.isFunctionStart</h4> 260 <h4>BaseDocstringGenerator.isFunctionStart</h4>
264 <b>isFunctionStart</b>(<i>text</i>) 261 <b>isFunctionStart</b>(<i>text</i>)
265
266 <p> 262 <p>
267 Public method to test, if a text is the start of a function or method 263 Public method to test, if a text is the start of a function or method
268 definition. 264 definition.
269 </p> 265 </p>
266
270 <dl> 267 <dl>
271 268
272 <dt><i>text</i> (str)</dt> 269 <dt><i>text</i> (str)</dt>
273 <dd> 270 <dd>
274 line of text to be tested 271 line of text to be tested
290 <div align="right"><a href="#top">Up</a></div> 287 <div align="right"><a href="#top">Up</a></div>
291 <hr /> 288 <hr />
292 <hr /> 289 <hr />
293 <a NAME="DocstringMenuForEnterOnly" ID="DocstringMenuForEnterOnly"></a> 290 <a NAME="DocstringMenuForEnterOnly" ID="DocstringMenuForEnterOnly"></a>
294 <h2>DocstringMenuForEnterOnly</h2> 291 <h2>DocstringMenuForEnterOnly</h2>
295
296 <p> 292 <p>
297 Class implementing a special menu reacting to the enter/return keys only. 293 Class implementing a special menu reacting to the enter/return keys only.
298 </p> 294 </p>
299 <p> 295 <p>
300 If a keyboard input is not the "enter key", the menu is closed and the 296 If a keyboard input is not the "enter key", the menu is closed and the
301 input is inserted to the code editor. 297 input is inserted to the code editor.
302 </p> 298 </p>
299
303 <h3>Derived from</h3> 300 <h3>Derived from</h3>
304 QMenu 301 QMenu
305 <h3>Class Attributes</h3> 302 <h3>Class Attributes</h3>
306 303 <table>
307 <table> 304 <tr><td>None</td></tr>
308 <tr><td>None</td></tr> 305 </table>
309 </table> 306
310 <h3>Class Methods</h3> 307 <h3>Class Methods</h3>
311 308 <table>
312 <table> 309 <tr><td>None</td></tr>
313 <tr><td>None</td></tr> 310 </table>
314 </table> 311
315 <h3>Methods</h3> 312 <h3>Methods</h3>
316 313 <table>
317 <table>
318
319 <tr> 314 <tr>
320 <td><a href="#DocstringMenuForEnterOnly.__init__">DocstringMenuForEnterOnly</a></td> 315 <td><a href="#DocstringMenuForEnterOnly.__init__">DocstringMenuForEnterOnly</a></td>
321 <td>Constructor</td> 316 <td>Constructor</td>
322 </tr> 317 </tr>
323 <tr> 318 <tr>
324 <td><a href="#DocstringMenuForEnterOnly.keyPressEvent">keyPressEvent</a></td> 319 <td><a href="#DocstringMenuForEnterOnly.keyPressEvent">keyPressEvent</a></td>
325 <td>Protected method to handle key press events.</td> 320 <td>Protected method to handle key press events.</td>
326 </tr> 321 </tr>
327 </table> 322 </table>
323
328 <h3>Static Methods</h3> 324 <h3>Static Methods</h3>
329 325 <table>
330 <table> 326 <tr><td>None</td></tr>
331 <tr><td>None</td></tr> 327 </table>
332 </table> 328
333 329
334 <a NAME="DocstringMenuForEnterOnly.__init__" ID="DocstringMenuForEnterOnly.__init__"></a> 330 <a NAME="DocstringMenuForEnterOnly.__init__" ID="DocstringMenuForEnterOnly.__init__"></a>
335 <h4>DocstringMenuForEnterOnly (Constructor)</h4> 331 <h4>DocstringMenuForEnterOnly (Constructor)</h4>
336 <b>DocstringMenuForEnterOnly</b>(<i>editor</i>) 332 <b>DocstringMenuForEnterOnly</b>(<i>editor</i>)
337
338 <p> 333 <p>
339 Constructor 334 Constructor
340 </p> 335 </p>
336
341 <dl> 337 <dl>
342 338
343 <dt><i>editor</i> (Editor)</dt> 339 <dt><i>editor</i> (Editor)</dt>
344 <dd> 340 <dd>
345 reference to the editor 341 reference to the editor
346 </dd> 342 </dd>
347 </dl> 343 </dl>
348 <a NAME="DocstringMenuForEnterOnly.keyPressEvent" ID="DocstringMenuForEnterOnly.keyPressEvent"></a> 344 <a NAME="DocstringMenuForEnterOnly.keyPressEvent" ID="DocstringMenuForEnterOnly.keyPressEvent"></a>
349 <h4>DocstringMenuForEnterOnly.keyPressEvent</h4> 345 <h4>DocstringMenuForEnterOnly.keyPressEvent</h4>
350 <b>keyPressEvent</b>(<i>evt</i>) 346 <b>keyPressEvent</b>(<i>evt</i>)
351
352 <p> 347 <p>
353 Protected method to handle key press events. 348 Protected method to handle key press events.
354 </p> 349 </p>
350
355 <dl> 351 <dl>
356 352
357 <dt><i>evt</i> (QKeyEvent)</dt> 353 <dt><i>evt</i> (QKeyEvent)</dt>
358 <dd> 354 <dd>
359 reference to the key press event object 355 reference to the key press event object
362 <div align="right"><a href="#top">Up</a></div> 358 <div align="right"><a href="#top">Up</a></div>
363 <hr /> 359 <hr />
364 <hr /> 360 <hr />
365 <a NAME="FunctionInfo" ID="FunctionInfo"></a> 361 <a NAME="FunctionInfo" ID="FunctionInfo"></a>
366 <h2>FunctionInfo</h2> 362 <h2>FunctionInfo</h2>
367
368 <p> 363 <p>
369 Class implementing an object to store function information. 364 Class implementing an object to store function information.
370 </p> 365 </p>
371 <p> 366 <p>
372 Methods to extract the relevant information need to be implemented in 367 Methods to extract the relevant information need to be implemented in
373 language specific subclasses. 368 language specific subclasses.
374 </p> 369 </p>
370
375 <h3>Derived from</h3> 371 <h3>Derived from</h3>
376 None 372 None
377 <h3>Class Attributes</h3> 373 <h3>Class Attributes</h3>
378 374 <table>
379 <table> 375 <tr><td>None</td></tr>
380 <tr><td>None</td></tr> 376 </table>
381 </table> 377
382 <h3>Class Methods</h3> 378 <h3>Class Methods</h3>
383 379 <table>
384 <table> 380 <tr><td>None</td></tr>
385 <tr><td>None</td></tr> 381 </table>
386 </table> 382
387 <h3>Methods</h3> 383 <h3>Methods</h3>
388 384 <table>
389 <table>
390
391 <tr> 385 <tr>
392 <td><a href="#FunctionInfo.__init__">FunctionInfo</a></td> 386 <td><a href="#FunctionInfo.__init__">FunctionInfo</a></td>
393 <td>Constructor</td> 387 <td>Constructor</td>
394 </tr> 388 </tr>
395 <tr> 389 <tr>
399 <tr> 393 <tr>
400 <td><a href="#FunctionInfo.parseDefinition">parseDefinition</a></td> 394 <td><a href="#FunctionInfo.parseDefinition">parseDefinition</a></td>
401 <td>Public method to parse the function definition text.</td> 395 <td>Public method to parse the function definition text.</td>
402 </tr> 396 </tr>
403 </table> 397 </table>
398
404 <h3>Static Methods</h3> 399 <h3>Static Methods</h3>
405 400 <table>
406 <table> 401 <tr><td>None</td></tr>
407 <tr><td>None</td></tr> 402 </table>
408 </table> 403
409 404
410 <a NAME="FunctionInfo.__init__" ID="FunctionInfo.__init__"></a> 405 <a NAME="FunctionInfo.__init__" ID="FunctionInfo.__init__"></a>
411 <h4>FunctionInfo (Constructor)</h4> 406 <h4>FunctionInfo (Constructor)</h4>
412 <b>FunctionInfo</b>(<i></i>) 407 <b>FunctionInfo</b>(<i></i>)
413
414 <p> 408 <p>
415 Constructor 409 Constructor
416 </p> 410 </p>
411
417 <a NAME="FunctionInfo.parseBody" ID="FunctionInfo.parseBody"></a> 412 <a NAME="FunctionInfo.parseBody" ID="FunctionInfo.parseBody"></a>
418 <h4>FunctionInfo.parseBody</h4> 413 <h4>FunctionInfo.parseBody</h4>
419 <b>parseBody</b>(<i>text</i>) 414 <b>parseBody</b>(<i>text</i>)
420
421 <p> 415 <p>
422 Public method to parse the function body text. 416 Public method to parse the function body text.
423 </p> 417 </p>
424 <p> 418 <p>
425 Note: This method should be overwritten in subclasses. 419 Note: This method should be overwritten in subclasses.
426 </p> 420 </p>
421
427 <dl> 422 <dl>
428 423
429 <dt><i>text</i> (str)</dt> 424 <dt><i>text</i> (str)</dt>
430 <dd> 425 <dd>
431 function body text 426 function body text
432 </dd> 427 </dd>
433 </dl> 428 </dl>
434 <a NAME="FunctionInfo.parseDefinition" ID="FunctionInfo.parseDefinition"></a> 429 <a NAME="FunctionInfo.parseDefinition" ID="FunctionInfo.parseDefinition"></a>
435 <h4>FunctionInfo.parseDefinition</h4> 430 <h4>FunctionInfo.parseDefinition</h4>
436 <b>parseDefinition</b>(<i>text, quote, quoteReplace</i>) 431 <b>parseDefinition</b>(<i>text, quote, quoteReplace</i>)
437
438 <p> 432 <p>
439 Public method to parse the function definition text. 433 Public method to parse the function definition text.
440 </p> 434 </p>
441 <p> 435 <p>
442 Note: This method should be overwritten in subclasses. 436 Note: This method should be overwritten in subclasses.
443 </p> 437 </p>
438
444 <dl> 439 <dl>
445 440
446 <dt><i>text</i> (str)</dt> 441 <dt><i>text</i> (str)</dt>
447 <dd> 442 <dd>
448 text containing the function definition 443 text containing the function definition
460 <hr /> 455 <hr />
461 <hr /> 456 <hr />
462 <a NAME="getIndentStr" ID="getIndentStr"></a> 457 <a NAME="getIndentStr" ID="getIndentStr"></a>
463 <h2>getIndentStr</h2> 458 <h2>getIndentStr</h2>
464 <b>getIndentStr</b>(<i>text</i>) 459 <b>getIndentStr</b>(<i>text</i>)
465
466 <p> 460 <p>
467 Function to get the indentation of a text. 461 Function to get the indentation of a text.
468 </p> 462 </p>
463
469 <dl> 464 <dl>
470 465
471 <dt><i>text</i> (str)</dt> 466 <dt><i>text</i> (str)</dt>
472 <dd> 467 <dd>
473 text to extract indentation from 468 text to extract indentation from

eric ide

mercurial