|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer</title> |
|
6 <style> |
|
7 body { |
|
8 background: #EDECE6; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #85774A; } |
|
14 h2 { color: white; background: #85774A; } |
|
15 h3 { color: white; background: #9D936E; } |
|
16 h4 { color: white; background: #9D936E; } |
|
17 |
|
18 a { color: #BA6D36; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer</h1> |
|
24 <p> |
|
25 Module implementing a class to fix certain PEP 8 issues. |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>Pep8FixableIssues</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr> |
|
34 <td><a href="#Pep8Fixer">Pep8Fixer</a></td> |
|
35 <td>Class implementing a fixer for certain PEP 8 issues.</td> |
|
36 </tr> |
|
37 </table> |
|
38 <h3>Functions</h3> |
|
39 <table> |
|
40 <tr><td>None</td></tr> |
|
41 </table> |
|
42 <hr /><hr /> |
|
43 <a NAME="Pep8Fixer" ID="Pep8Fixer"></a> |
|
44 <h2>Pep8Fixer</h2> |
|
45 <p> |
|
46 Class implementing a fixer for certain PEP 8 issues. |
|
47 </p> |
|
48 <h3>Derived from</h3> |
|
49 QObject |
|
50 <h3>Class Attributes</h3> |
|
51 <table> |
|
52 <tr><td>None</td></tr> |
|
53 </table> |
|
54 <h3>Methods</h3> |
|
55 <table> |
|
56 <tr> |
|
57 <td><a href="#Pep8Fixer.__init__">Pep8Fixer</a></td> |
|
58 <td>Constructor</td> |
|
59 </tr><tr> |
|
60 <td><a href="#Pep8Fixer.__finalize">__finalize</a></td> |
|
61 <td>Private method to apply all deferred fixes.</td> |
|
62 </tr><tr> |
|
63 <td><a href="#Pep8Fixer.__fixBlankLinesAfterDecorator">__fixBlankLinesAfterDecorator</a></td> |
|
64 <td>Private method to fix superfluous blank lines after a function decorator.</td> |
|
65 </tr><tr> |
|
66 <td><a href="#Pep8Fixer.__fixMissingWhitespaceAfter">__fixMissingWhitespaceAfter</a></td> |
|
67 <td>Private method to fix missing whitespace after ',;:'.</td> |
|
68 </tr><tr> |
|
69 <td><a href="#Pep8Fixer.__fixMissingWhitespaceAroundOperator">__fixMissingWhitespaceAroundOperator</a></td> |
|
70 <td>Private method to fix missing whitespace after ',;:'.</td> |
|
71 </tr><tr> |
|
72 <td><a href="#Pep8Fixer.__fixNewline">__fixNewline</a></td> |
|
73 <td>Private method to fix a missing newline at the end of file.</td> |
|
74 </tr><tr> |
|
75 <td><a href="#Pep8Fixer.__fixNotEqual">__fixNotEqual</a></td> |
|
76 <td>Private method to fix the not equal notation.</td> |
|
77 </tr><tr> |
|
78 <td><a href="#Pep8Fixer.__fixOneBlankLine">__fixOneBlankLine</a></td> |
|
79 <td>Private method to fix the need for one blank line.</td> |
|
80 </tr><tr> |
|
81 <td><a href="#Pep8Fixer.__fixTabs">__fixTabs</a></td> |
|
82 <td>Private method to fix obsolete tab usage.</td> |
|
83 </tr><tr> |
|
84 <td><a href="#Pep8Fixer.__fixTooManyBlankLines">__fixTooManyBlankLines</a></td> |
|
85 <td>Private method to fix superfluous blank lines.</td> |
|
86 </tr><tr> |
|
87 <td><a href="#Pep8Fixer.__fixTrailingBlankLines">__fixTrailingBlankLines</a></td> |
|
88 <td>Private method to fix trailing blank lines.</td> |
|
89 </tr><tr> |
|
90 <td><a href="#Pep8Fixer.__fixTwoBlankLines">__fixTwoBlankLines</a></td> |
|
91 <td>Private method to fix the need for two blank lines.</td> |
|
92 </tr><tr> |
|
93 <td><a href="#Pep8Fixer.__fixWhitespace">__fixWhitespace</a></td> |
|
94 <td>Private method to fix trailing whitespace.</td> |
|
95 </tr><tr> |
|
96 <td><a href="#Pep8Fixer.__fixWhitespaceAfter">__fixWhitespaceAfter</a></td> |
|
97 <td>Private method to fix superfluous whitespace after '([{'.</td> |
|
98 </tr><tr> |
|
99 <td><a href="#Pep8Fixer.__fixWhitespaceAfterInline">__fixWhitespaceAfterInline</a></td> |
|
100 <td>Private method to fix whitespace after inline comment.</td> |
|
101 </tr><tr> |
|
102 <td><a href="#Pep8Fixer.__fixWhitespaceAroundEquals">__fixWhitespaceAroundEquals</a></td> |
|
103 <td>Private method to fix extraneous whitespace around keyword and default parameter equals.</td> |
|
104 </tr><tr> |
|
105 <td><a href="#Pep8Fixer.__fixWhitespaceAroundOperator">__fixWhitespaceAroundOperator</a></td> |
|
106 <td>Private method to fix extraneous whitespace around operator.</td> |
|
107 </tr><tr> |
|
108 <td><a href="#Pep8Fixer.__fixWhitespaceBefore">__fixWhitespaceBefore</a></td> |
|
109 <td>Private method to fix superfluous whitespace before '}])', ',;:' and '(['.</td> |
|
110 </tr><tr> |
|
111 <td><a href="#Pep8Fixer.__fixWhitespaceBeforeInline">__fixWhitespaceBeforeInline</a></td> |
|
112 <td>Private method to fix missing whitespace before inline comment.</td> |
|
113 </tr><tr> |
|
114 <td><a href="#Pep8Fixer.__getEol">__getEol</a></td> |
|
115 <td>Private method to get the applicable eol string.</td> |
|
116 </tr><tr> |
|
117 <td><a href="#Pep8Fixer.fixIssue">fixIssue</a></td> |
|
118 <td>Public method to fix the fixable issues.</td> |
|
119 </tr><tr> |
|
120 <td><a href="#Pep8Fixer.saveFile">saveFile</a></td> |
|
121 <td>Public method to save the modified file.</td> |
|
122 </tr> |
|
123 </table> |
|
124 <a NAME="Pep8Fixer.__init__" ID="Pep8Fixer.__init__"></a> |
|
125 <h4>Pep8Fixer (Constructor)</h4> |
|
126 <b>Pep8Fixer</b>(<i>project, filename, sourceLines, fixCodes, inPlace</i>) |
|
127 <p> |
|
128 Constructor |
|
129 </p><dl> |
|
130 <dt><i>project</i></dt> |
|
131 <dd> |
|
132 reference to the project object (Project) |
|
133 </dd><dt><i>filename</i></dt> |
|
134 <dd> |
|
135 name of the file to be fixed (string) |
|
136 </dd><dt><i>sourceLines</i></dt> |
|
137 <dd> |
|
138 list of source lines including eol marker |
|
139 (list of string) |
|
140 </dd><dt><i>fixCodes</i></dt> |
|
141 <dd> |
|
142 list of codes to be fixed as a comma separated |
|
143 string (string) |
|
144 </dd><dt><i>inPlace</i></dt> |
|
145 <dd> |
|
146 flag indicating to modify the file in place (boolean) |
|
147 </dd> |
|
148 </dl><a NAME="Pep8Fixer.__finalize" ID="Pep8Fixer.__finalize"></a> |
|
149 <h4>Pep8Fixer.__finalize</h4> |
|
150 <b>__finalize</b>(<i></i>) |
|
151 <p> |
|
152 Private method to apply all deferred fixes. |
|
153 </p><a NAME="Pep8Fixer.__fixBlankLinesAfterDecorator" ID="Pep8Fixer.__fixBlankLinesAfterDecorator"></a> |
|
154 <h4>Pep8Fixer.__fixBlankLinesAfterDecorator</h4> |
|
155 <b>__fixBlankLinesAfterDecorator</b>(<i>code, line, pos, apply=False</i>) |
|
156 <p> |
|
157 Private method to fix superfluous blank lines after a function |
|
158 decorator. |
|
159 </p><dl> |
|
160 <dt><i>code</i></dt> |
|
161 <dd> |
|
162 code of the issue (string) |
|
163 </dd><dt><i>line</i></dt> |
|
164 <dd> |
|
165 line number of the issue (integer) |
|
166 </dd><dt><i>pos</i></dt> |
|
167 <dd> |
|
168 position inside line (integer) |
|
169 </dd><dt><i>apply=</i></dt> |
|
170 <dd> |
|
171 flag indicating, that the fix should be applied |
|
172 (boolean) |
|
173 </dd> |
|
174 </dl><dl> |
|
175 <dt>Returns:</dt> |
|
176 <dd> |
|
177 flag indicating an applied fix (boolean) and a message for |
|
178 the fix (string) |
|
179 </dd> |
|
180 </dl><a NAME="Pep8Fixer.__fixMissingWhitespaceAfter" ID="Pep8Fixer.__fixMissingWhitespaceAfter"></a> |
|
181 <h4>Pep8Fixer.__fixMissingWhitespaceAfter</h4> |
|
182 <b>__fixMissingWhitespaceAfter</b>(<i>code, line, pos, apply=False</i>) |
|
183 <p> |
|
184 Private method to fix missing whitespace after ',;:'. |
|
185 </p><dl> |
|
186 <dt><i>code</i></dt> |
|
187 <dd> |
|
188 code of the issue (string) |
|
189 </dd><dt><i>line</i></dt> |
|
190 <dd> |
|
191 line number of the issue (integer) |
|
192 </dd><dt><i>pos</i></dt> |
|
193 <dd> |
|
194 position inside line (integer) |
|
195 </dd><dt><i>apply=</i></dt> |
|
196 <dd> |
|
197 flag indicating, that the fix should be applied |
|
198 (boolean) |
|
199 </dd> |
|
200 </dl><dl> |
|
201 <dt>Returns:</dt> |
|
202 <dd> |
|
203 flag indicating an applied fix (boolean) and a message for |
|
204 the fix (string) |
|
205 </dd> |
|
206 </dl><a NAME="Pep8Fixer.__fixMissingWhitespaceAroundOperator" ID="Pep8Fixer.__fixMissingWhitespaceAroundOperator"></a> |
|
207 <h4>Pep8Fixer.__fixMissingWhitespaceAroundOperator</h4> |
|
208 <b>__fixMissingWhitespaceAroundOperator</b>(<i>code, line, pos, apply=False</i>) |
|
209 <p> |
|
210 Private method to fix missing whitespace after ',;:'. |
|
211 </p><dl> |
|
212 <dt><i>code</i></dt> |
|
213 <dd> |
|
214 code of the issue (string) |
|
215 </dd><dt><i>line</i></dt> |
|
216 <dd> |
|
217 line number of the issue (integer) |
|
218 </dd><dt><i>pos</i></dt> |
|
219 <dd> |
|
220 position inside line (integer) |
|
221 </dd><dt><i>apply=</i></dt> |
|
222 <dd> |
|
223 flag indicating, that the fix should be applied |
|
224 (boolean) |
|
225 </dd> |
|
226 </dl><dl> |
|
227 <dt>Returns:</dt> |
|
228 <dd> |
|
229 flag indicating an applied fix (boolean) and a message for |
|
230 the fix (string) |
|
231 </dd> |
|
232 </dl><a NAME="Pep8Fixer.__fixNewline" ID="Pep8Fixer.__fixNewline"></a> |
|
233 <h4>Pep8Fixer.__fixNewline</h4> |
|
234 <b>__fixNewline</b>(<i>code, line, pos</i>) |
|
235 <p> |
|
236 Private method to fix a missing newline at the end of file. |
|
237 </p><dl> |
|
238 <dt><i>code</i></dt> |
|
239 <dd> |
|
240 code of the issue (string) |
|
241 </dd><dt><i>line</i></dt> |
|
242 <dd> |
|
243 line number of the issue (integer) |
|
244 </dd><dt><i>pos</i></dt> |
|
245 <dd> |
|
246 position inside line (integer) |
|
247 </dd> |
|
248 </dl><dl> |
|
249 <dt>Returns:</dt> |
|
250 <dd> |
|
251 flag indicating an applied fix (boolean) and a message for |
|
252 the fix (string) |
|
253 </dd> |
|
254 </dl><a NAME="Pep8Fixer.__fixNotEqual" ID="Pep8Fixer.__fixNotEqual"></a> |
|
255 <h4>Pep8Fixer.__fixNotEqual</h4> |
|
256 <b>__fixNotEqual</b>(<i>code, line, pos</i>) |
|
257 <p> |
|
258 Private method to fix the not equal notation. |
|
259 </p><dl> |
|
260 <dt><i>code</i></dt> |
|
261 <dd> |
|
262 code of the issue (string) |
|
263 </dd><dt><i>line</i></dt> |
|
264 <dd> |
|
265 line number of the issue (integer) |
|
266 </dd><dt><i>pos</i></dt> |
|
267 <dd> |
|
268 position inside line (integer) |
|
269 </dd> |
|
270 </dl><dl> |
|
271 <dt>Returns:</dt> |
|
272 <dd> |
|
273 flag indicating an applied fix (boolean) and a message for |
|
274 the fix (string) |
|
275 </dd> |
|
276 </dl><a NAME="Pep8Fixer.__fixOneBlankLine" ID="Pep8Fixer.__fixOneBlankLine"></a> |
|
277 <h4>Pep8Fixer.__fixOneBlankLine</h4> |
|
278 <b>__fixOneBlankLine</b>(<i>code, line, pos, apply=False</i>) |
|
279 <p> |
|
280 Private method to fix the need for one blank line. |
|
281 </p><dl> |
|
282 <dt><i>code</i></dt> |
|
283 <dd> |
|
284 code of the issue (string) |
|
285 </dd><dt><i>line</i></dt> |
|
286 <dd> |
|
287 line number of the issue (integer) |
|
288 </dd><dt><i>pos</i></dt> |
|
289 <dd> |
|
290 position inside line (integer) |
|
291 </dd><dt><i>apply=</i></dt> |
|
292 <dd> |
|
293 flag indicating, that the fix should be applied |
|
294 (boolean) |
|
295 </dd> |
|
296 </dl><dl> |
|
297 <dt>Returns:</dt> |
|
298 <dd> |
|
299 flag indicating an applied fix (boolean) and a message for |
|
300 the fix (string) |
|
301 </dd> |
|
302 </dl><a NAME="Pep8Fixer.__fixTabs" ID="Pep8Fixer.__fixTabs"></a> |
|
303 <h4>Pep8Fixer.__fixTabs</h4> |
|
304 <b>__fixTabs</b>(<i>code, line, pos</i>) |
|
305 <p> |
|
306 Private method to fix obsolete tab usage. |
|
307 </p><dl> |
|
308 <dt><i>code</i></dt> |
|
309 <dd> |
|
310 code of the issue (string) |
|
311 </dd><dt><i>line</i></dt> |
|
312 <dd> |
|
313 line number of the issue (integer) |
|
314 </dd><dt><i>pos</i></dt> |
|
315 <dd> |
|
316 position inside line (integer) |
|
317 </dd> |
|
318 </dl><dl> |
|
319 <dt>Returns:</dt> |
|
320 <dd> |
|
321 flag indicating an applied fix (boolean) and a message for |
|
322 the fix (string) |
|
323 </dd> |
|
324 </dl><a NAME="Pep8Fixer.__fixTooManyBlankLines" ID="Pep8Fixer.__fixTooManyBlankLines"></a> |
|
325 <h4>Pep8Fixer.__fixTooManyBlankLines</h4> |
|
326 <b>__fixTooManyBlankLines</b>(<i>code, line, pos, apply=False</i>) |
|
327 <p> |
|
328 Private method to fix superfluous blank lines. |
|
329 </p><dl> |
|
330 <dt><i>code</i></dt> |
|
331 <dd> |
|
332 code of the issue (string) |
|
333 </dd><dt><i>line</i></dt> |
|
334 <dd> |
|
335 line number of the issue (integer) |
|
336 </dd><dt><i>pos</i></dt> |
|
337 <dd> |
|
338 position inside line (integer) |
|
339 </dd><dt><i>apply=</i></dt> |
|
340 <dd> |
|
341 flag indicating, that the fix should be applied |
|
342 (boolean) |
|
343 </dd> |
|
344 </dl><dl> |
|
345 <dt>Returns:</dt> |
|
346 <dd> |
|
347 flag indicating an applied fix (boolean) and a message for |
|
348 the fix (string) |
|
349 </dd> |
|
350 </dl><a NAME="Pep8Fixer.__fixTrailingBlankLines" ID="Pep8Fixer.__fixTrailingBlankLines"></a> |
|
351 <h4>Pep8Fixer.__fixTrailingBlankLines</h4> |
|
352 <b>__fixTrailingBlankLines</b>(<i>code, line, pos</i>) |
|
353 <p> |
|
354 Private method to fix trailing blank lines. |
|
355 </p><dl> |
|
356 <dt><i>code</i></dt> |
|
357 <dd> |
|
358 code of the issue (string) |
|
359 </dd><dt><i>line</i></dt> |
|
360 <dd> |
|
361 line number of the issue (integer) |
|
362 </dd><dt><i>pos</i></dt> |
|
363 <dd> |
|
364 position inside line (integer) |
|
365 </dd> |
|
366 </dl><dl> |
|
367 <dt>Returns:</dt> |
|
368 <dd> |
|
369 flag indicating an applied fix (boolean) and a message for |
|
370 the fix (string) |
|
371 </dd> |
|
372 </dl><a NAME="Pep8Fixer.__fixTwoBlankLines" ID="Pep8Fixer.__fixTwoBlankLines"></a> |
|
373 <h4>Pep8Fixer.__fixTwoBlankLines</h4> |
|
374 <b>__fixTwoBlankLines</b>(<i>code, line, pos, apply=False</i>) |
|
375 <p> |
|
376 Private method to fix the need for two blank lines. |
|
377 </p><a NAME="Pep8Fixer.__fixWhitespace" ID="Pep8Fixer.__fixWhitespace"></a> |
|
378 <h4>Pep8Fixer.__fixWhitespace</h4> |
|
379 <b>__fixWhitespace</b>(<i>code, line, pos</i>) |
|
380 <p> |
|
381 Private method to fix trailing whitespace. |
|
382 </p><dl> |
|
383 <dt><i>code</i></dt> |
|
384 <dd> |
|
385 code of the issue (string) |
|
386 </dd><dt><i>line</i></dt> |
|
387 <dd> |
|
388 line number of the issue (integer) |
|
389 </dd><dt><i>pos</i></dt> |
|
390 <dd> |
|
391 position inside line (integer) |
|
392 </dd> |
|
393 </dl><dl> |
|
394 <dt>Returns:</dt> |
|
395 <dd> |
|
396 flag indicating an applied fix (boolean) and a message for |
|
397 the fix (string) |
|
398 </dd> |
|
399 </dl><a NAME="Pep8Fixer.__fixWhitespaceAfter" ID="Pep8Fixer.__fixWhitespaceAfter"></a> |
|
400 <h4>Pep8Fixer.__fixWhitespaceAfter</h4> |
|
401 <b>__fixWhitespaceAfter</b>(<i>code, line, pos, apply=False</i>) |
|
402 <p> |
|
403 Private method to fix superfluous whitespace after '([{'. |
|
404 </p><dl> |
|
405 <dt><i>code</i></dt> |
|
406 <dd> |
|
407 code of the issue (string) |
|
408 </dd><dt><i>line</i></dt> |
|
409 <dd> |
|
410 line number of the issue (integer) |
|
411 </dd><dt><i>pos</i></dt> |
|
412 <dd> |
|
413 position inside line (integer) |
|
414 </dd><dt><i>apply=</i></dt> |
|
415 <dd> |
|
416 flag indicating, that the fix should be applied |
|
417 (boolean) |
|
418 </dd> |
|
419 </dl><dl> |
|
420 <dt>Returns:</dt> |
|
421 <dd> |
|
422 flag indicating an applied fix (boolean) and a message for |
|
423 the fix (string) |
|
424 </dd> |
|
425 </dl><a NAME="Pep8Fixer.__fixWhitespaceAfterInline" ID="Pep8Fixer.__fixWhitespaceAfterInline"></a> |
|
426 <h4>Pep8Fixer.__fixWhitespaceAfterInline</h4> |
|
427 <b>__fixWhitespaceAfterInline</b>(<i>code, line, pos, apply=False</i>) |
|
428 <p> |
|
429 Private method to fix whitespace after inline comment. |
|
430 </p><dl> |
|
431 <dt><i>code</i></dt> |
|
432 <dd> |
|
433 code of the issue (string) |
|
434 </dd><dt><i>line</i></dt> |
|
435 <dd> |
|
436 line number of the issue (integer) |
|
437 </dd><dt><i>pos</i></dt> |
|
438 <dd> |
|
439 position inside line (integer) |
|
440 </dd><dt><i>apply=</i></dt> |
|
441 <dd> |
|
442 flag indicating, that the fix should be applied |
|
443 (boolean) |
|
444 </dd> |
|
445 </dl><dl> |
|
446 <dt>Returns:</dt> |
|
447 <dd> |
|
448 flag indicating an applied fix (boolean) and a message for |
|
449 the fix (string) |
|
450 </dd> |
|
451 </dl><a NAME="Pep8Fixer.__fixWhitespaceAroundEquals" ID="Pep8Fixer.__fixWhitespaceAroundEquals"></a> |
|
452 <h4>Pep8Fixer.__fixWhitespaceAroundEquals</h4> |
|
453 <b>__fixWhitespaceAroundEquals</b>(<i>code, line, pos, apply=False</i>) |
|
454 <p> |
|
455 Private method to fix extraneous whitespace around keyword and |
|
456 default parameter equals. |
|
457 </p><dl> |
|
458 <dt><i>code</i></dt> |
|
459 <dd> |
|
460 code of the issue (string) |
|
461 </dd><dt><i>line</i></dt> |
|
462 <dd> |
|
463 line number of the issue (integer) |
|
464 </dd><dt><i>pos</i></dt> |
|
465 <dd> |
|
466 position inside line (integer) |
|
467 </dd><dt><i>apply=</i></dt> |
|
468 <dd> |
|
469 flag indicating, that the fix should be applied |
|
470 (boolean) |
|
471 </dd> |
|
472 </dl><dl> |
|
473 <dt>Returns:</dt> |
|
474 <dd> |
|
475 flag indicating an applied fix (boolean) and a message for |
|
476 the fix (string) |
|
477 </dd> |
|
478 </dl><a NAME="Pep8Fixer.__fixWhitespaceAroundOperator" ID="Pep8Fixer.__fixWhitespaceAroundOperator"></a> |
|
479 <h4>Pep8Fixer.__fixWhitespaceAroundOperator</h4> |
|
480 <b>__fixWhitespaceAroundOperator</b>(<i>code, line, pos, apply=False</i>) |
|
481 <p> |
|
482 Private method to fix extraneous whitespace around operator. |
|
483 </p><dl> |
|
484 <dt><i>code</i></dt> |
|
485 <dd> |
|
486 code of the issue (string) |
|
487 </dd><dt><i>line</i></dt> |
|
488 <dd> |
|
489 line number of the issue (integer) |
|
490 </dd><dt><i>pos</i></dt> |
|
491 <dd> |
|
492 position inside line (integer) |
|
493 </dd><dt><i>apply=</i></dt> |
|
494 <dd> |
|
495 flag indicating, that the fix should be applied |
|
496 (boolean) |
|
497 </dd> |
|
498 </dl><dl> |
|
499 <dt>Returns:</dt> |
|
500 <dd> |
|
501 flag indicating an applied fix (boolean) and a message for |
|
502 the fix (string) |
|
503 </dd> |
|
504 </dl><a NAME="Pep8Fixer.__fixWhitespaceBefore" ID="Pep8Fixer.__fixWhitespaceBefore"></a> |
|
505 <h4>Pep8Fixer.__fixWhitespaceBefore</h4> |
|
506 <b>__fixWhitespaceBefore</b>(<i>code, line, pos, apply=False</i>) |
|
507 <p> |
|
508 Private method to fix superfluous whitespace before '}])', |
|
509 ',;:' and '(['. |
|
510 </p><dl> |
|
511 <dt><i>code</i></dt> |
|
512 <dd> |
|
513 code of the issue (string) |
|
514 </dd><dt><i>line</i></dt> |
|
515 <dd> |
|
516 line number of the issue (integer) |
|
517 </dd><dt><i>pos</i></dt> |
|
518 <dd> |
|
519 position inside line (integer) |
|
520 </dd><dt><i>apply=</i></dt> |
|
521 <dd> |
|
522 flag indicating, that the fix should be applied |
|
523 (boolean) |
|
524 </dd> |
|
525 </dl><dl> |
|
526 <dt>Returns:</dt> |
|
527 <dd> |
|
528 flag indicating an applied fix (boolean) and a message for |
|
529 the fix (string) |
|
530 </dd> |
|
531 </dl><a NAME="Pep8Fixer.__fixWhitespaceBeforeInline" ID="Pep8Fixer.__fixWhitespaceBeforeInline"></a> |
|
532 <h4>Pep8Fixer.__fixWhitespaceBeforeInline</h4> |
|
533 <b>__fixWhitespaceBeforeInline</b>(<i>code, line, pos, apply=False</i>) |
|
534 <p> |
|
535 Private method to fix missing whitespace before inline comment. |
|
536 </p><dl> |
|
537 <dt><i>code</i></dt> |
|
538 <dd> |
|
539 code of the issue (string) |
|
540 </dd><dt><i>line</i></dt> |
|
541 <dd> |
|
542 line number of the issue (integer) |
|
543 </dd><dt><i>pos</i></dt> |
|
544 <dd> |
|
545 position inside line (integer) |
|
546 </dd><dt><i>apply=</i></dt> |
|
547 <dd> |
|
548 flag indicating, that the fix should be applied |
|
549 (boolean) |
|
550 </dd> |
|
551 </dl><dl> |
|
552 <dt>Returns:</dt> |
|
553 <dd> |
|
554 flag indicating an applied fix (boolean) and a message for |
|
555 the fix (string) |
|
556 </dd> |
|
557 </dl><a NAME="Pep8Fixer.__getEol" ID="Pep8Fixer.__getEol"></a> |
|
558 <h4>Pep8Fixer.__getEol</h4> |
|
559 <b>__getEol</b>(<i></i>) |
|
560 <p> |
|
561 Private method to get the applicable eol string. |
|
562 </p><dl> |
|
563 <dt>Returns:</dt> |
|
564 <dd> |
|
565 eol string (string) |
|
566 </dd> |
|
567 </dl><a NAME="Pep8Fixer.fixIssue" ID="Pep8Fixer.fixIssue"></a> |
|
568 <h4>Pep8Fixer.fixIssue</h4> |
|
569 <b>fixIssue</b>(<i>line, pos, message</i>) |
|
570 <p> |
|
571 Public method to fix the fixable issues. |
|
572 </p><dl> |
|
573 <dt><i>line</i></dt> |
|
574 <dd> |
|
575 line number of issue (integer or string) |
|
576 </dd><dt><i>pos</i></dt> |
|
577 <dd> |
|
578 character position of issue (integer or string) |
|
579 </dd><dt><i>message</i></dt> |
|
580 <dd> |
|
581 message text (string) |
|
582 </dd> |
|
583 </dl><dl> |
|
584 <dt>Returns:</dt> |
|
585 <dd> |
|
586 flag indicating an applied fix (boolean) and a message for |
|
587 the fix (string) |
|
588 </dd> |
|
589 </dl><a NAME="Pep8Fixer.saveFile" ID="Pep8Fixer.saveFile"></a> |
|
590 <h4>Pep8Fixer.saveFile</h4> |
|
591 <b>saveFile</b>(<i>encoding</i>) |
|
592 <p> |
|
593 Public method to save the modified file. |
|
594 </p><dl> |
|
595 <dt><i>encoding</i></dt> |
|
596 <dd> |
|
597 encoding of the source file (string) |
|
598 </dd> |
|
599 </dl><dl> |
|
600 <dt>Returns:</dt> |
|
601 <dd> |
|
602 flag indicating success (boolean) |
|
603 </dd> |
|
604 </dl> |
|
605 <div align="right"><a href="#top">Up</a></div> |
|
606 <hr /> |
|
607 </body></html> |