|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.QScintilla.DocstringGenerator.PyDocstringGenerator</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.QScintilla.DocstringGenerator.PyDocstringGenerator</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a docstring generator for Python. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#PyDocstringGenerator">PyDocstringGenerator</a></td> |
|
25 <td>Class implementing a docstring generator for Python.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#PyFunctionInfo">PyFunctionInfo</a></td> |
|
29 <td>Class implementing an object to extract and store function information.</td> |
|
30 </tr> |
|
31 </table> |
|
32 <h3>Functions</h3> |
|
33 |
|
34 <table> |
|
35 <tr><td>None</td></tr> |
|
36 </table> |
|
37 <hr /> |
|
38 <hr /> |
|
39 <a NAME="PyDocstringGenerator" ID="PyDocstringGenerator"></a> |
|
40 <h2>PyDocstringGenerator</h2> |
|
41 |
|
42 <p> |
|
43 Class implementing a docstring generator for Python. |
|
44 </p> |
|
45 <h3>Derived from</h3> |
|
46 BaseDocstringGenerator |
|
47 <h3>Class Attributes</h3> |
|
48 |
|
49 <table> |
|
50 <tr><td>None</td></tr> |
|
51 </table> |
|
52 <h3>Class Methods</h3> |
|
53 |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 |
|
59 <table> |
|
60 |
|
61 <tr> |
|
62 <td><a href="#PyDocstringGenerator.__init__">PyDocstringGenerator</a></td> |
|
63 <td>Constructor</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#PyDocstringGenerator.__generateDocstring">__generateDocstring</a></td> |
|
67 <td>Private method to generate the list of docstring lines.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#PyDocstringGenerator.__generateDocstringFromBelow">__generateDocstringFromBelow</a></td> |
|
71 <td>Private method to generate a docstring when the gicen position is on the line below the end of the definition.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#PyDocstringGenerator.__generateDocstringFromStart">__generateDocstringFromStart</a></td> |
|
75 <td>Private method to generate a docstring based on the cursor being placed on the first line of the definition.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#PyDocstringGenerator.__getFunctionBody">__getFunctionBody</a></td> |
|
79 <td>Private method to get the function body.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#PyDocstringGenerator.__getFunctionDefinitionFromBelow">__getFunctionDefinitionFromBelow</a></td> |
|
83 <td>Private method to extract the function definition based on the cursor being placed on the first line after the definition.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#PyDocstringGenerator.__getFunctionDefinitionFromStart">__getFunctionDefinitionFromStart</a></td> |
|
87 <td>Private method to extract the function definition based on the cursor being placed on the first line of the definition.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#PyDocstringGenerator.__getIndentationInsertString">__getIndentationInsertString</a></td> |
|
91 <td>Private method to create the indentation string for the docstring.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#PyDocstringGenerator.__isTripleQuotesStart">__isTripleQuotesStart</a></td> |
|
95 <td>Private method to test, if the given text is the start of a triple quoted string.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#PyDocstringGenerator.hasFunctionDefinition">hasFunctionDefinition</a></td> |
|
99 <td>Public method to test, if the cursor is right below a function definition.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#PyDocstringGenerator.insertDocstring">insertDocstring</a></td> |
|
103 <td>Public method to insert a docstring for the function at the cursor position.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#PyDocstringGenerator.insertDocstringFromShortcut">insertDocstringFromShortcut</a></td> |
|
107 <td>Public method to insert a docstring for the function at the cursor position initiated via a keyboard shortcut.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#PyDocstringGenerator.isDocstringIntro">isDocstringIntro</a></td> |
|
111 <td>Public function to test, if the line up to the cursor position might be introducing a docstring.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#PyDocstringGenerator.isFunctionStart">isFunctionStart</a></td> |
|
115 <td>Public method to test, if a text is the start of a function or method definition.</td> |
|
116 </tr> |
|
117 </table> |
|
118 <h3>Static Methods</h3> |
|
119 |
|
120 <table> |
|
121 <tr><td>None</td></tr> |
|
122 </table> |
|
123 |
|
124 <a NAME="PyDocstringGenerator.__init__" ID="PyDocstringGenerator.__init__"></a> |
|
125 <h4>PyDocstringGenerator (Constructor)</h4> |
|
126 <b>PyDocstringGenerator</b>(<i>editor</i>) |
|
127 |
|
128 <p> |
|
129 Constructor |
|
130 </p> |
|
131 <dl> |
|
132 |
|
133 <dt><i>editor</i> (Editor)</dt> |
|
134 <dd> |
|
135 reference to the editor widget |
|
136 </dd> |
|
137 </dl> |
|
138 <a NAME="PyDocstringGenerator.__generateDocstring" ID="PyDocstringGenerator.__generateDocstring"></a> |
|
139 <h4>PyDocstringGenerator.__generateDocstring</h4> |
|
140 <b>__generateDocstring</b>(<i>quote, functionDef, bodyStartLine</i>) |
|
141 |
|
142 <p> |
|
143 Private method to generate the list of docstring lines. |
|
144 </p> |
|
145 <dl> |
|
146 |
|
147 <dt><i>quote</i> (str)</dt> |
|
148 <dd> |
|
149 quote string |
|
150 </dd> |
|
151 <dt><i>functionDef</i> (str)</dt> |
|
152 <dd> |
|
153 text containing the function definition |
|
154 </dd> |
|
155 <dt><i>bodyStartLine</i> (int)</dt> |
|
156 <dd> |
|
157 starting line of the function body |
|
158 </dd> |
|
159 </dl> |
|
160 <dl> |
|
161 <dt>Return:</dt> |
|
162 <dd> |
|
163 list of docstring lines |
|
164 </dd> |
|
165 </dl> |
|
166 <dl> |
|
167 <dt>Return Type:</dt> |
|
168 <dd> |
|
169 list of str |
|
170 </dd> |
|
171 </dl> |
|
172 <a NAME="PyDocstringGenerator.__generateDocstringFromBelow" ID="PyDocstringGenerator.__generateDocstringFromBelow"></a> |
|
173 <h4>PyDocstringGenerator.__generateDocstringFromBelow</h4> |
|
174 <b>__generateDocstringFromBelow</b>(<i>cursorPosition</i>) |
|
175 |
|
176 <p> |
|
177 Private method to generate a docstring when the gicen position is on |
|
178 the line below the end of the definition. |
|
179 </p> |
|
180 <dl> |
|
181 |
|
182 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> |
|
183 <dd> |
|
184 position of the cursor (line and index) |
|
185 </dd> |
|
186 </dl> |
|
187 <dl> |
|
188 <dt>Return:</dt> |
|
189 <dd> |
|
190 tuple containing the docstring and a tuple containing the |
|
191 insertion line and index |
|
192 </dd> |
|
193 </dl> |
|
194 <dl> |
|
195 <dt>Return Type:</dt> |
|
196 <dd> |
|
197 tuple of (str, tuple(int, int)) |
|
198 </dd> |
|
199 </dl> |
|
200 <a NAME="PyDocstringGenerator.__generateDocstringFromStart" ID="PyDocstringGenerator.__generateDocstringFromStart"></a> |
|
201 <h4>PyDocstringGenerator.__generateDocstringFromStart</h4> |
|
202 <b>__generateDocstringFromStart</b>(<i></i>) |
|
203 |
|
204 <p> |
|
205 Private method to generate a docstring based on the cursor being |
|
206 placed on the first line of the definition. |
|
207 </p> |
|
208 <dl> |
|
209 <dt>Return:</dt> |
|
210 <dd> |
|
211 tuple containing the docstring and a tuple containing the |
|
212 insertion line and index |
|
213 </dd> |
|
214 </dl> |
|
215 <dl> |
|
216 <dt>Return Type:</dt> |
|
217 <dd> |
|
218 tuple of (str, tuple(int, int)) |
|
219 </dd> |
|
220 </dl> |
|
221 <a NAME="PyDocstringGenerator.__getFunctionBody" ID="PyDocstringGenerator.__getFunctionBody"></a> |
|
222 <h4>PyDocstringGenerator.__getFunctionBody</h4> |
|
223 <b>__getFunctionBody</b>(<i>functionIndent, startLine</i>) |
|
224 |
|
225 <p> |
|
226 Private method to get the function body. |
|
227 </p> |
|
228 <dl> |
|
229 |
|
230 <dt><i>functionIndent</i> (str)</dt> |
|
231 <dd> |
|
232 indentation string of the function definition |
|
233 </dd> |
|
234 <dt><i>startLine</i> (int)</dt> |
|
235 <dd> |
|
236 starting line for the extraction process |
|
237 </dd> |
|
238 </dl> |
|
239 <dl> |
|
240 <dt>Return:</dt> |
|
241 <dd> |
|
242 text containing the function body |
|
243 </dd> |
|
244 </dl> |
|
245 <dl> |
|
246 <dt>Return Type:</dt> |
|
247 <dd> |
|
248 str |
|
249 </dd> |
|
250 </dl> |
|
251 <a NAME="PyDocstringGenerator.__getFunctionDefinitionFromBelow" ID="PyDocstringGenerator.__getFunctionDefinitionFromBelow"></a> |
|
252 <h4>PyDocstringGenerator.__getFunctionDefinitionFromBelow</h4> |
|
253 <b>__getFunctionDefinitionFromBelow</b>(<i>cursorPosition</i>) |
|
254 |
|
255 <p> |
|
256 Private method to extract the function definition based on the cursor |
|
257 being placed on the first line after the definition. |
|
258 </p> |
|
259 <dl> |
|
260 |
|
261 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> |
|
262 <dd> |
|
263 current cursor position (line and column) |
|
264 </dd> |
|
265 </dl> |
|
266 <dl> |
|
267 <dt>Return:</dt> |
|
268 <dd> |
|
269 text containing the function definition |
|
270 </dd> |
|
271 </dl> |
|
272 <dl> |
|
273 <dt>Return Type:</dt> |
|
274 <dd> |
|
275 str |
|
276 </dd> |
|
277 </dl> |
|
278 <a NAME="PyDocstringGenerator.__getFunctionDefinitionFromStart" ID="PyDocstringGenerator.__getFunctionDefinitionFromStart"></a> |
|
279 <h4>PyDocstringGenerator.__getFunctionDefinitionFromStart</h4> |
|
280 <b>__getFunctionDefinitionFromStart</b>(<i></i>) |
|
281 |
|
282 <p> |
|
283 Private method to extract the function definition based on the cursor |
|
284 being placed on the first line of the definition. |
|
285 </p> |
|
286 <dl> |
|
287 <dt>Return:</dt> |
|
288 <dd> |
|
289 text containing the function definition |
|
290 </dd> |
|
291 </dl> |
|
292 <dl> |
|
293 <dt>Return Type:</dt> |
|
294 <dd> |
|
295 str |
|
296 </dd> |
|
297 </dl> |
|
298 <a NAME="PyDocstringGenerator.__getIndentationInsertString" ID="PyDocstringGenerator.__getIndentationInsertString"></a> |
|
299 <h4>PyDocstringGenerator.__getIndentationInsertString</h4> |
|
300 <b>__getIndentationInsertString</b>(<i>text</i>) |
|
301 |
|
302 <p> |
|
303 Private method to create the indentation string for the docstring. |
|
304 </p> |
|
305 <dl> |
|
306 |
|
307 <dt><i>text</i> (str)</dt> |
|
308 <dd> |
|
309 text to based the indentation on |
|
310 </dd> |
|
311 </dl> |
|
312 <dl> |
|
313 <dt>Return:</dt> |
|
314 <dd> |
|
315 indentation string for docstring |
|
316 </dd> |
|
317 </dl> |
|
318 <dl> |
|
319 <dt>Return Type:</dt> |
|
320 <dd> |
|
321 str |
|
322 </dd> |
|
323 </dl> |
|
324 <a NAME="PyDocstringGenerator.__isTripleQuotesStart" ID="PyDocstringGenerator.__isTripleQuotesStart"></a> |
|
325 <h4>PyDocstringGenerator.__isTripleQuotesStart</h4> |
|
326 <b>__isTripleQuotesStart</b>(<i>text</i>) |
|
327 |
|
328 <p> |
|
329 Private method to test, if the given text is the start of a triple |
|
330 quoted string. |
|
331 </p> |
|
332 <dl> |
|
333 |
|
334 <dt><i>text</i> (str)</dt> |
|
335 <dd> |
|
336 text to be inspected |
|
337 </dd> |
|
338 </dl> |
|
339 <dl> |
|
340 <dt>Return:</dt> |
|
341 <dd> |
|
342 flag indicating a triple quote start |
|
343 </dd> |
|
344 </dl> |
|
345 <dl> |
|
346 <dt>Return Type:</dt> |
|
347 <dd> |
|
348 bool |
|
349 </dd> |
|
350 </dl> |
|
351 <a NAME="PyDocstringGenerator.hasFunctionDefinition" ID="PyDocstringGenerator.hasFunctionDefinition"></a> |
|
352 <h4>PyDocstringGenerator.hasFunctionDefinition</h4> |
|
353 <b>hasFunctionDefinition</b>(<i>cursorPosition</i>) |
|
354 |
|
355 <p> |
|
356 Public method to test, if the cursor is right below a function |
|
357 definition. |
|
358 </p> |
|
359 <dl> |
|
360 |
|
361 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> |
|
362 <dd> |
|
363 current cursor position (line and column) |
|
364 </dd> |
|
365 </dl> |
|
366 <dl> |
|
367 <dt>Return:</dt> |
|
368 <dd> |
|
369 flag indicating cursor is right below a function definition |
|
370 </dd> |
|
371 </dl> |
|
372 <dl> |
|
373 <dt>Return Type:</dt> |
|
374 <dd> |
|
375 bool |
|
376 </dd> |
|
377 </dl> |
|
378 <a NAME="PyDocstringGenerator.insertDocstring" ID="PyDocstringGenerator.insertDocstring"></a> |
|
379 <h4>PyDocstringGenerator.insertDocstring</h4> |
|
380 <b>insertDocstring</b>(<i>cursorPosition, fromStart=True</i>) |
|
381 |
|
382 <p> |
|
383 Public method to insert a docstring for the function at the cursor |
|
384 position. |
|
385 </p> |
|
386 <dl> |
|
387 |
|
388 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> |
|
389 <dd> |
|
390 position of the cursor (line and index) |
|
391 </dd> |
|
392 <dt><i>fromStart</i> (bool)</dt> |
|
393 <dd> |
|
394 flag indicating that the editor text cursor is placed |
|
395 on the line starting the function definition |
|
396 </dd> |
|
397 </dl> |
|
398 <a NAME="PyDocstringGenerator.insertDocstringFromShortcut" ID="PyDocstringGenerator.insertDocstringFromShortcut"></a> |
|
399 <h4>PyDocstringGenerator.insertDocstringFromShortcut</h4> |
|
400 <b>insertDocstringFromShortcut</b>(<i>cursorPosition</i>) |
|
401 |
|
402 <p> |
|
403 Public method to insert a docstring for the function at the cursor |
|
404 position initiated via a keyboard shortcut. |
|
405 </p> |
|
406 <dl> |
|
407 |
|
408 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> |
|
409 <dd> |
|
410 position of the cursor (line and index) |
|
411 </dd> |
|
412 </dl> |
|
413 <a NAME="PyDocstringGenerator.isDocstringIntro" ID="PyDocstringGenerator.isDocstringIntro"></a> |
|
414 <h4>PyDocstringGenerator.isDocstringIntro</h4> |
|
415 <b>isDocstringIntro</b>(<i>cursorPosition</i>) |
|
416 |
|
417 <p> |
|
418 Public function to test, if the line up to the cursor position might be |
|
419 introducing a docstring. |
|
420 </p> |
|
421 <dl> |
|
422 |
|
423 <dt><i>cursorPosition</i> (tuple of (int, int))</dt> |
|
424 <dd> |
|
425 current cursor position (line and column) |
|
426 </dd> |
|
427 </dl> |
|
428 <dl> |
|
429 <dt>Return:</dt> |
|
430 <dd> |
|
431 flag indicating a potential start of a docstring |
|
432 </dd> |
|
433 </dl> |
|
434 <dl> |
|
435 <dt>Return Type:</dt> |
|
436 <dd> |
|
437 bool |
|
438 </dd> |
|
439 </dl> |
|
440 <a NAME="PyDocstringGenerator.isFunctionStart" ID="PyDocstringGenerator.isFunctionStart"></a> |
|
441 <h4>PyDocstringGenerator.isFunctionStart</h4> |
|
442 <b>isFunctionStart</b>(<i>text</i>) |
|
443 |
|
444 <p> |
|
445 Public method to test, if a text is the start of a function or method |
|
446 definition. |
|
447 </p> |
|
448 <dl> |
|
449 |
|
450 <dt><i>text</i> (str)</dt> |
|
451 <dd> |
|
452 line of text to be tested |
|
453 </dd> |
|
454 </dl> |
|
455 <dl> |
|
456 <dt>Return:</dt> |
|
457 <dd> |
|
458 flag indicating that the given text starts a function or |
|
459 method definition |
|
460 </dd> |
|
461 </dl> |
|
462 <dl> |
|
463 <dt>Return Type:</dt> |
|
464 <dd> |
|
465 bool |
|
466 </dd> |
|
467 </dl> |
|
468 <div align="right"><a href="#top">Up</a></div> |
|
469 <hr /> |
|
470 <hr /> |
|
471 <a NAME="PyFunctionInfo" ID="PyFunctionInfo"></a> |
|
472 <h2>PyFunctionInfo</h2> |
|
473 |
|
474 <p> |
|
475 Class implementing an object to extract and store function information. |
|
476 </p> |
|
477 <h3>Derived from</h3> |
|
478 FunctionInfo |
|
479 <h3>Class Attributes</h3> |
|
480 |
|
481 <table> |
|
482 <tr><td>None</td></tr> |
|
483 </table> |
|
484 <h3>Class Methods</h3> |
|
485 |
|
486 <table> |
|
487 <tr><td>None</td></tr> |
|
488 </table> |
|
489 <h3>Methods</h3> |
|
490 |
|
491 <table> |
|
492 |
|
493 <tr> |
|
494 <td><a href="#PyFunctionInfo.__init__">PyFunctionInfo</a></td> |
|
495 <td>Constructor</td> |
|
496 </tr> |
|
497 <tr> |
|
498 <td><a href="#PyFunctionInfo.__findBracketPosition">__findBracketPosition</a></td> |
|
499 <td>Private method to find the start and end position of pairs of brackets.</td> |
|
500 </tr> |
|
501 <tr> |
|
502 <td><a href="#PyFunctionInfo.__findQuotePosition">__findQuotePosition</a></td> |
|
503 <td>Private method to find the start and end position of pairs of quotes.</td> |
|
504 </tr> |
|
505 <tr> |
|
506 <td><a href="#PyFunctionInfo.__isCharInPairs">__isCharInPairs</a></td> |
|
507 <td>Private method to test, if the given character position is between pairs of brackets or quotes.</td> |
|
508 </tr> |
|
509 <tr> |
|
510 <td><a href="#PyFunctionInfo.__splitArgumentToNameTypeValue">__splitArgumentToNameTypeValue</a></td> |
|
511 <td>Private method to split some argument text to name, type and value.</td> |
|
512 </tr> |
|
513 <tr> |
|
514 <td><a href="#PyFunctionInfo.__splitArgumentsTextToList">__splitArgumentsTextToList</a></td> |
|
515 <td>Private method to split the given arguments text into a list of arguments.</td> |
|
516 </tr> |
|
517 <tr> |
|
518 <td><a href="#PyFunctionInfo.parseBody">parseBody</a></td> |
|
519 <td>Public method to parse the function body text.</td> |
|
520 </tr> |
|
521 <tr> |
|
522 <td><a href="#PyFunctionInfo.parseDefinition">parseDefinition</a></td> |
|
523 <td>Public method to parse the function definition text.</td> |
|
524 </tr> |
|
525 </table> |
|
526 <h3>Static Methods</h3> |
|
527 |
|
528 <table> |
|
529 <tr><td>None</td></tr> |
|
530 </table> |
|
531 |
|
532 <a NAME="PyFunctionInfo.__init__" ID="PyFunctionInfo.__init__"></a> |
|
533 <h4>PyFunctionInfo (Constructor)</h4> |
|
534 <b>PyFunctionInfo</b>(<i></i>) |
|
535 |
|
536 <p> |
|
537 Constructor |
|
538 </p> |
|
539 <a NAME="PyFunctionInfo.__findBracketPosition" ID="PyFunctionInfo.__findBracketPosition"></a> |
|
540 <h4>PyFunctionInfo.__findBracketPosition</h4> |
|
541 <b>__findBracketPosition</b>(<i>text, bracketLeft, bracketRight, posQuote</i>) |
|
542 |
|
543 <p> |
|
544 Private method to find the start and end position of pairs of brackets. |
|
545 </p> |
|
546 <p> |
|
547 https://stackoverflow.com/questions/29991917/ |
|
548 indices-of-matching-parentheses-in-python |
|
549 </p> |
|
550 <dl> |
|
551 |
|
552 <dt><i>text</i> (str)</dt> |
|
553 <dd> |
|
554 text to be parsed |
|
555 </dd> |
|
556 <dt><i>bracketLeft</i> (str)</dt> |
|
557 <dd> |
|
558 character of the left bracket |
|
559 </dd> |
|
560 <dt><i>bracketRight</i> (str)</dt> |
|
561 <dd> |
|
562 character of the right bracket |
|
563 </dd> |
|
564 <dt><i>posQuote</i> (list of tuple of (int, int))</dt> |
|
565 <dd> |
|
566 list of tuple with start and end position of pairs |
|
567 of quotes |
|
568 </dd> |
|
569 </dl> |
|
570 <dl> |
|
571 <dt>Return:</dt> |
|
572 <dd> |
|
573 list of tuple with start and end position of pairs of brackets |
|
574 </dd> |
|
575 </dl> |
|
576 <dl> |
|
577 <dt>Return Type:</dt> |
|
578 <dd> |
|
579 list of tuple of (int, int) |
|
580 </dd> |
|
581 </dl> |
|
582 <dl> |
|
583 |
|
584 <dt>Raises <b>IndexError</b>:</dt> |
|
585 <dd> |
|
586 raised when a closing or opening bracket is |
|
587 missing |
|
588 </dd> |
|
589 </dl> |
|
590 <a NAME="PyFunctionInfo.__findQuotePosition" ID="PyFunctionInfo.__findQuotePosition"></a> |
|
591 <h4>PyFunctionInfo.__findQuotePosition</h4> |
|
592 <b>__findQuotePosition</b>(<i>text</i>) |
|
593 |
|
594 <p> |
|
595 Private method to find the start and end position of pairs of quotes. |
|
596 </p> |
|
597 <dl> |
|
598 |
|
599 <dt><i>text</i> (str)</dt> |
|
600 <dd> |
|
601 text to be parsed |
|
602 </dd> |
|
603 </dl> |
|
604 <dl> |
|
605 <dt>Return:</dt> |
|
606 <dd> |
|
607 list of tuple with start and end position of pairs of quotes |
|
608 </dd> |
|
609 </dl> |
|
610 <dl> |
|
611 <dt>Return Type:</dt> |
|
612 <dd> |
|
613 list of tuple of (int, int) |
|
614 </dd> |
|
615 </dl> |
|
616 <dl> |
|
617 |
|
618 <dt>Raises <b>IndexError</b>:</dt> |
|
619 <dd> |
|
620 raised when a matching close quote is missing |
|
621 </dd> |
|
622 </dl> |
|
623 <a NAME="PyFunctionInfo.__isCharInPairs" ID="PyFunctionInfo.__isCharInPairs"></a> |
|
624 <h4>PyFunctionInfo.__isCharInPairs</h4> |
|
625 <b>__isCharInPairs</b>(<i>posChar, pairs</i>) |
|
626 |
|
627 <p> |
|
628 Private method to test, if the given character position is between |
|
629 pairs of brackets or quotes. |
|
630 </p> |
|
631 <dl> |
|
632 |
|
633 <dt><i>posChar</i> (int)</dt> |
|
634 <dd> |
|
635 character position to be tested |
|
636 </dd> |
|
637 <dt><i>pairs</i> (list of tuple of (int, int))</dt> |
|
638 <dd> |
|
639 list containing pairs of positions |
|
640 </dd> |
|
641 </dl> |
|
642 <dl> |
|
643 <dt>Return:</dt> |
|
644 <dd> |
|
645 flag indicating the position is in between |
|
646 </dd> |
|
647 </dl> |
|
648 <dl> |
|
649 <dt>Return Type:</dt> |
|
650 <dd> |
|
651 bool |
|
652 </dd> |
|
653 </dl> |
|
654 <a NAME="PyFunctionInfo.__splitArgumentToNameTypeValue" ID="PyFunctionInfo.__splitArgumentToNameTypeValue"></a> |
|
655 <h4>PyFunctionInfo.__splitArgumentToNameTypeValue</h4> |
|
656 <b>__splitArgumentToNameTypeValue</b>(<i>argumentsList, quote, quoteReplace</i>) |
|
657 |
|
658 <p> |
|
659 Private method to split some argument text to name, type and value. |
|
660 </p> |
|
661 <dl> |
|
662 |
|
663 <dt><i>argumentsList</i> (list of str)</dt> |
|
664 <dd> |
|
665 list of function argument definitions |
|
666 </dd> |
|
667 <dt><i>quote</i> (str)</dt> |
|
668 <dd> |
|
669 quote string to be replaced |
|
670 </dd> |
|
671 <dt><i>quoteReplace</i> (str)</dt> |
|
672 <dd> |
|
673 quote string to replace the original |
|
674 </dd> |
|
675 </dl> |
|
676 <a NAME="PyFunctionInfo.__splitArgumentsTextToList" ID="PyFunctionInfo.__splitArgumentsTextToList"></a> |
|
677 <h4>PyFunctionInfo.__splitArgumentsTextToList</h4> |
|
678 <b>__splitArgumentsTextToList</b>(<i>argumentsText</i>) |
|
679 |
|
680 <p> |
|
681 Private method to split the given arguments text into a list of |
|
682 arguments. |
|
683 </p> |
|
684 <p> |
|
685 This function uses a comma to separate arguments and ignores a comma in |
|
686 brackets and quotes. |
|
687 </p> |
|
688 <dl> |
|
689 |
|
690 <dt><i>argumentsText</i> (str)</dt> |
|
691 <dd> |
|
692 text containing the list of arguments |
|
693 </dd> |
|
694 </dl> |
|
695 <dl> |
|
696 <dt>Return:</dt> |
|
697 <dd> |
|
698 list of individual argument texts |
|
699 </dd> |
|
700 </dl> |
|
701 <dl> |
|
702 <dt>Return Type:</dt> |
|
703 <dd> |
|
704 list of str |
|
705 </dd> |
|
706 </dl> |
|
707 <a NAME="PyFunctionInfo.parseBody" ID="PyFunctionInfo.parseBody"></a> |
|
708 <h4>PyFunctionInfo.parseBody</h4> |
|
709 <b>parseBody</b>(<i>text</i>) |
|
710 |
|
711 <p> |
|
712 Public method to parse the function body text. |
|
713 </p> |
|
714 <dl> |
|
715 |
|
716 <dt><i>text</i> (str)</dt> |
|
717 <dd> |
|
718 function body text |
|
719 </dd> |
|
720 </dl> |
|
721 <a NAME="PyFunctionInfo.parseDefinition" ID="PyFunctionInfo.parseDefinition"></a> |
|
722 <h4>PyFunctionInfo.parseDefinition</h4> |
|
723 <b>parseDefinition</b>(<i>text, quote, quoteReplace</i>) |
|
724 |
|
725 <p> |
|
726 Public method to parse the function definition text. |
|
727 </p> |
|
728 <dl> |
|
729 |
|
730 <dt><i>text</i> (str)</dt> |
|
731 <dd> |
|
732 text containing the function definition |
|
733 </dd> |
|
734 <dt><i>quote</i> (str)</dt> |
|
735 <dd> |
|
736 quote string to be replaced |
|
737 </dd> |
|
738 <dt><i>quoteReplace</i> (str)</dt> |
|
739 <dd> |
|
740 quote string to replace the original |
|
741 </dd> |
|
742 </dl> |
|
743 <div align="right"><a href="#top">Up</a></div> |
|
744 <hr /> |
|
745 </body></html> |