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