src/eric7/Documentation/Source/eric7.CodeFormatting.BlackFormattingDialog.html

branch
eric7
changeset 9295
d14096c04126
parent 9236
db53a9efe7ef
child 9344
52990830b13f
equal deleted inserted replaced
9294:3c12aacd98d8 9295:d14096c04126
23 <tr> 23 <tr>
24 <td><a href="#BlackFormattingDialog">BlackFormattingDialog</a></td> 24 <td><a href="#BlackFormattingDialog">BlackFormattingDialog</a></td>
25 <td>Class implementing a dialog showing the code formatting progress and the result.</td> 25 <td>Class implementing a dialog showing the code formatting progress and the result.</td>
26 </tr> 26 </tr>
27 <tr> 27 <tr>
28 <td><a href="#BlackMultiprocessingReport">BlackMultiprocessingReport</a></td>
29 <td>Class extending the black Report to work with multiprocessing.</td>
30 </tr>
31 <tr>
32 <td><a href="#BlackMultiprocessingResult">BlackMultiprocessingResult</a></td>
33 <td>Class containing the reformatting result data.</td>
34 </tr>
35 <tr>
28 <td><a href="#BlackReport">BlackReport</a></td> 36 <td><a href="#BlackReport">BlackReport</a></td>
29 <td>Class extending the black Report to work with our dialog.</td> 37 <td>Class extending the black Report to work with our dialog.</td>
38 </tr>
39 <tr>
40 <td><a href="#BlackStatistics">BlackStatistics</a></td>
41 <td>Class containing the reformatting statistic data.</td>
30 </tr> 42 </tr>
31 </table> 43 </table>
32 <h3>Functions</h3> 44 <h3>Functions</h3>
33 45
34 <table> 46 <table>
61 <tr> 73 <tr>
62 <td><a href="#BlackFormattingDialog.__init__">BlackFormattingDialog</a></td> 74 <td><a href="#BlackFormattingDialog.__init__">BlackFormattingDialog</a></td>
63 <td>Constructor</td> 75 <td>Constructor</td>
64 </tr> 76 </tr>
65 <tr> 77 <tr>
66 <td><a href="#BlackFormattingDialog.__diffFormatFile">__diffFormatFile</a></td>
67 <td>Private method to check, if the given files need to be reformatted, and generate a unified diff.</td>
68 </tr>
69 <tr>
70 <td><a href="#BlackFormattingDialog.__filterFiles">__filterFiles</a></td> 78 <td><a href="#BlackFormattingDialog.__filterFiles">__filterFiles</a></td>
71 <td>Private method to filter the given list of files according the configuration parameters.</td> 79 <td>Private method to filter the given list of files according the configuration parameters.</td>
72 </tr> 80 </tr>
73 <tr> 81 <tr>
74 <td><a href="#BlackFormattingDialog.__finish">__finish</a></td> 82 <td><a href="#BlackFormattingDialog.__finish">__finish</a></td>
75 <td>Private method to perform some actions after the run was performed or canceled.</td> 83 <td>Private method to perform some actions after the run was performed or canceled.</td>
76 </tr> 84 </tr>
77 <tr> 85 <tr>
78 <td><a href="#BlackFormattingDialog.__formatFiles">__formatFiles</a></td> 86 <td><a href="#BlackFormattingDialog.__formatManyFiles">__formatManyFiles</a></td>
87 <td>Private method to format the list of files according the configuration using multiple processes in parallel.</td>
88 </tr>
89 <tr>
90 <td><a href="#BlackFormattingDialog.__formatOneFile">__formatOneFile</a></td>
79 <td>Private method to format the list of files according the configuration.</td> 91 <td>Private method to format the list of files according the configuration.</td>
92 </tr>
93 <tr>
94 <td><a href="#BlackFormattingDialog.__handleBlackFormattingResult">__handleBlackFormattingResult</a></td>
95 <td>Private slot to handle the result of a black reformatting action.</td>
80 </tr> 96 </tr>
81 <tr> 97 <tr>
82 <td><a href="#BlackFormattingDialog.__populateStatusFilterCombo">__populateStatusFilterCombo</a></td> 98 <td><a href="#BlackFormattingDialog.__populateStatusFilterCombo">__populateStatusFilterCombo</a></td>
83 <td>Private method to populate the status filter combo box with allowed selections.</td> 99 <td>Private method to populate the status filter combo box with allowed selections.</td>
84 </tr> 100 </tr>
93 <tr> 109 <tr>
94 <td><a href="#BlackFormattingDialog.__updateStatistics">__updateStatistics</a></td> 110 <td><a href="#BlackFormattingDialog.__updateStatistics">__updateStatistics</a></td>
95 <td>Private method to update the statistics about the recent formatting run and make them visible.</td> 111 <td>Private method to update the statistics about the recent formatting run and make them visible.</td>
96 </tr> 112 </tr>
97 <tr> 113 <tr>
98 <td><a href="#BlackFormattingDialog.addResultEntry">addResultEntry</a></td>
99 <td>Public method to add an entry to the result list.</td>
100 </tr>
101 <tr>
102 <td><a href="#BlackFormattingDialog.closeEvent">closeEvent</a></td> 114 <td><a href="#BlackFormattingDialog.closeEvent">closeEvent</a></td>
103 <td>Protected slot implementing a close event handler.</td> 115 <td>Protected slot implementing a close event handler.</td>
104 </tr> 116 </tr>
105 <tr> 117 <tr>
106 <td><a href="#BlackFormattingDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> 118 <td><a href="#BlackFormattingDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td>
116 </tr> 128 </tr>
117 </table> 129 </table>
118 <h3>Static Methods</h3> 130 <h3>Static Methods</h3>
119 131
120 <table> 132 <table>
121 <tr><td>None</td></tr> 133
134 <tr>
135 <td><a href="#BlackFormattingDialog.__diffFormatFile">__diffFormatFile</a></td>
136 <td>Static method to check, if the given files need to be reformatted, and generate a unified diff.</td>
137 </tr>
138 <tr>
139 <td><a href="#BlackFormattingDialog.formattingWorkerTask">formattingWorkerTask</a></td>
140 <td>Static method acting as the parallel worker for the formatting task.</td>
141 </tr>
122 </table> 142 </table>
123 143
124 <a NAME="BlackFormattingDialog.__init__" ID="BlackFormattingDialog.__init__"></a> 144 <a NAME="BlackFormattingDialog.__init__" ID="BlackFormattingDialog.__init__"></a>
125 <h4>BlackFormattingDialog (Constructor)</h4> 145 <h4>BlackFormattingDialog (Constructor)</h4>
126 <b>BlackFormattingDialog</b>(<i>configuration, filesList, project=None, action=BlackFormattingAction.Format, parent=None, </i>) 146 <b>BlackFormattingDialog</b>(<i>configuration, filesList, project=None, action=BlackFormattingAction.Format, parent=None, </i>)
149 <dt><i>parent</i> (QWidget (optional))</dt> 169 <dt><i>parent</i> (QWidget (optional))</dt>
150 <dd> 170 <dd>
151 reference to the parent widget (defaults to None) 171 reference to the parent widget (defaults to None)
152 </dd> 172 </dd>
153 </dl> 173 </dl>
154 <a NAME="BlackFormattingDialog.__diffFormatFile" ID="BlackFormattingDialog.__diffFormatFile"></a>
155 <h4>BlackFormattingDialog.__diffFormatFile</h4>
156 <b>__diffFormatFile</b>(<i>src, fast, mode, report</i>)
157
158 <p>
159 Private method to check, if the given files need to be reformatted, and generate
160 a unified diff.
161 </p>
162 <dl>
163
164 <dt><i>src</i> (pathlib.Path)</dt>
165 <dd>
166 path of file to be checked
167 </dd>
168 <dt><i>fast</i> (bool)</dt>
169 <dd>
170 flag indicating fast operation
171 </dd>
172 <dt><i>mode</i> (black.Mode)</dt>
173 <dd>
174 code formatting options
175 </dd>
176 <dt><i>report</i> (BlackReport)</dt>
177 <dd>
178 reference to the report object
179 </dd>
180 </dl>
181 <a NAME="BlackFormattingDialog.__filterFiles" ID="BlackFormattingDialog.__filterFiles"></a> 174 <a NAME="BlackFormattingDialog.__filterFiles" ID="BlackFormattingDialog.__filterFiles"></a>
182 <h4>BlackFormattingDialog.__filterFiles</h4> 175 <h4>BlackFormattingDialog.__filterFiles</h4>
183 <b>__filterFiles</b>(<i>filesList</i>) 176 <b>__filterFiles</b>(<i>filesList</i>)
184 177
185 <p> 178 <p>
210 <b>__finish</b>(<i></i>) 203 <b>__finish</b>(<i></i>)
211 204
212 <p> 205 <p>
213 Private method to perform some actions after the run was performed or canceled. 206 Private method to perform some actions after the run was performed or canceled.
214 </p> 207 </p>
215 <a NAME="BlackFormattingDialog.__formatFiles" ID="BlackFormattingDialog.__formatFiles"></a> 208 <a NAME="BlackFormattingDialog.__formatManyFiles" ID="BlackFormattingDialog.__formatManyFiles"></a>
216 <h4>BlackFormattingDialog.__formatFiles</h4> 209 <h4>BlackFormattingDialog.__formatManyFiles</h4>
217 <b>__formatFiles</b>(<i></i>) 210 <b>__formatManyFiles</b>(<i>files</i>)
211
212 <p>
213 Private method to format the list of files according the configuration using
214 multiple processes in parallel.
215 </p>
216 <dl>
217
218 <dt><i>files</i> (list of str)</dt>
219 <dd>
220 list of files to be processed
221 </dd>
222 </dl>
223 <a NAME="BlackFormattingDialog.__formatOneFile" ID="BlackFormattingDialog.__formatOneFile"></a>
224 <h4>BlackFormattingDialog.__formatOneFile</h4>
225 <b>__formatOneFile</b>(<i>file</i>)
218 226
219 <p> 227 <p>
220 Private method to format the list of files according the configuration. 228 Private method to format the list of files according the configuration.
221 </p> 229 </p>
230 <dl>
231
232 <dt><i>file</i> (str)</dt>
233 <dd>
234 name of the file to be processed
235 </dd>
236 </dl>
237 <a NAME="BlackFormattingDialog.__handleBlackFormattingResult" ID="BlackFormattingDialog.__handleBlackFormattingResult"></a>
238 <h4>BlackFormattingDialog.__handleBlackFormattingResult</h4>
239 <b>__handleBlackFormattingResult</b>(<i>status, filename, data</i>)
240
241 <p>
242 Private slot to handle the result of a black reformatting action.
243 </p>
244 <dl>
245
246 <dt><i>status</i> (str)</dt>
247 <dd>
248 status of the performed action (one of 'changed', 'unchanged',
249 'unmodified', 'failed' or 'ignored')
250 </dd>
251 <dt><i>filename</i> (str)</dt>
252 <dd>
253 name of the processed file
254 </dd>
255 <dt><i>data</i> (str)</dt>
256 <dd>
257 action data (error message or unified diff)
258 </dd>
259 </dl>
222 <a NAME="BlackFormattingDialog.__populateStatusFilterCombo" ID="BlackFormattingDialog.__populateStatusFilterCombo"></a> 260 <a NAME="BlackFormattingDialog.__populateStatusFilterCombo" ID="BlackFormattingDialog.__populateStatusFilterCombo"></a>
223 <h4>BlackFormattingDialog.__populateStatusFilterCombo</h4> 261 <h4>BlackFormattingDialog.__populateStatusFilterCombo</h4>
224 <b>__populateStatusFilterCombo</b>(<i></i>) 262 <b>__populateStatusFilterCombo</b>(<i></i>)
225 263
226 <p> 264 <p>
246 284
247 <p> 285 <p>
248 Private method to update the statistics about the recent formatting run and 286 Private method to update the statistics about the recent formatting run and
249 make them visible. 287 make them visible.
250 </p> 288 </p>
251 <a NAME="BlackFormattingDialog.addResultEntry" ID="BlackFormattingDialog.addResultEntry"></a>
252 <h4>BlackFormattingDialog.addResultEntry</h4>
253 <b>addResultEntry</b>(<i>status, fileName, isError=False, data=None</i>)
254
255 <p>
256 Public method to add an entry to the result list.
257 </p>
258 <dl>
259
260 <dt><i>status</i> (str)</dt>
261 <dd>
262 status of the operation
263 </dd>
264 <dt><i>fileName</i> (str)</dt>
265 <dd>
266 name of the processed file
267 </dd>
268 <dt><i>isError</i> (bool (optional))</dt>
269 <dd>
270 flag indicating that data contains an error message (defaults to
271 False)
272 </dd>
273 <dt><i>data</i> (str (optional))</dt>
274 <dd>
275 associated data (diff or error message) (defaults to None)
276 </dd>
277 </dl>
278 <a NAME="BlackFormattingDialog.closeEvent" ID="BlackFormattingDialog.closeEvent"></a> 289 <a NAME="BlackFormattingDialog.closeEvent" ID="BlackFormattingDialog.closeEvent"></a>
279 <h4>BlackFormattingDialog.closeEvent</h4> 290 <h4>BlackFormattingDialog.closeEvent</h4>
280 <b>closeEvent</b>(<i>evt</i>) 291 <b>closeEvent</b>(<i>evt</i>)
281 292
282 <p> 293 <p>
333 <dt><i>status</i> (str)</dt> 344 <dt><i>status</i> (str)</dt>
334 <dd> 345 <dd>
335 selected status 346 selected status
336 </dd> 347 </dd>
337 </dl> 348 </dl>
349 <a NAME="BlackFormattingDialog.__diffFormatFile" ID="BlackFormattingDialog.__diffFormatFile"></a>
350 <h4>BlackFormattingDialog.__diffFormatFile (static)</h4>
351 <b>__diffFormatFile</b>(<i>fast, mode, report, relSrc=""</i>)
352
353 <p>
354 Static method to check, if the given files need to be reformatted, and generate
355 a unified diff.
356 </p>
357 <dl>
358
359 <dt><i>src</i> (pathlib.Path)</dt>
360 <dd>
361 path of file to be checked
362 </dd>
363 <dt><i>fast</i> (bool)</dt>
364 <dd>
365 flag indicating fast operation
366 </dd>
367 <dt><i>mode</i> (black.Mode)</dt>
368 <dd>
369 code formatting options
370 </dd>
371 <dt><i>report</i> (BlackReport)</dt>
372 <dd>
373 reference to the report object
374 </dd>
375 <dt><i>relSrc</i> (str (optional))</dt>
376 <dd>
377 name of the file relative to the project (defaults to "")
378 </dd>
379 </dl>
380 <a NAME="BlackFormattingDialog.formattingWorkerTask" ID="BlackFormattingDialog.formattingWorkerTask"></a>
381 <h4>BlackFormattingDialog.formattingWorkerTask (static)</h4>
382 <b>formattingWorkerTask</b>(<i>outputQueue, config</i>)
383
384 <p>
385 Static method acting as the parallel worker for the formatting task.
386 </p>
387 <dl>
388
389 <dt><i>inputQueue</i> (multiprocessing.Queue)</dt>
390 <dd>
391 input queue
392 </dd>
393 <dt><i>outputQueue</i> (multiprocessing.Queue)</dt>
394 <dd>
395 output queue
396 </dd>
397 <dt><i>config</i> (dict)</dt>
398 <dd>
399 dictionary containing the configuration parameters
400 </dd>
401 </dl>
338 <div align="right"><a href="#top">Up</a></div> 402 <div align="right"><a href="#top">Up</a></div>
339 <hr /> 403 <hr />
340 <hr /> 404 <hr />
341 <a NAME="BlackReport" ID="BlackReport"></a> 405 <a NAME="BlackMultiprocessingReport" ID="BlackMultiprocessingReport"></a>
342 <h2>BlackReport</h2> 406 <h2>BlackMultiprocessingReport</h2>
343 407
344 <p> 408 <p>
345 Class extending the black Report to work with our dialog. 409 Class extending the black Report to work with multiprocessing.
346 </p> 410 </p>
347 <h3>Derived from</h3> 411 <h3>Derived from</h3>
348 black.Report 412 black.Report
349 <h3>Class Attributes</h3> 413 <h3>Class Attributes</h3>
350 414
359 <h3>Methods</h3> 423 <h3>Methods</h3>
360 424
361 <table> 425 <table>
362 426
363 <tr> 427 <tr>
428 <td><a href="#BlackMultiprocessingReport.__init__">BlackMultiprocessingReport</a></td>
429 <td>Constructor</td>
430 </tr>
431 <tr>
432 <td><a href="#BlackMultiprocessingReport.done">done</a></td>
433 <td>Public method to handle the end of a reformat.</td>
434 </tr>
435 <tr>
436 <td><a href="#BlackMultiprocessingReport.failed">failed</a></td>
437 <td>Public method to handle a reformat failure.</td>
438 </tr>
439 <tr>
440 <td><a href="#BlackMultiprocessingReport.path_ignored">path_ignored</a></td>
441 <td>Public method handling an ignored path.</td>
442 </tr>
443 </table>
444 <h3>Static Methods</h3>
445
446 <table>
447 <tr><td>None</td></tr>
448 </table>
449
450 <a NAME="BlackMultiprocessingReport.__init__" ID="BlackMultiprocessingReport.__init__"></a>
451 <h4>BlackMultiprocessingReport (Constructor)</h4>
452 <b>BlackMultiprocessingReport</b>(<i>resultQueue</i>)
453
454 <p>
455 Constructor
456 </p>
457 <dl>
458
459 <dt><i>resultQueue</i> (multiprocessing.Queue)</dt>
460 <dd>
461 reference to the queue to put the results into
462 </dd>
463 </dl>
464 <a NAME="BlackMultiprocessingReport.done" ID="BlackMultiprocessingReport.done"></a>
465 <h4>BlackMultiprocessingReport.done</h4>
466 <b>done</b>(<i>src, changed, diff=""</i>)
467
468 <p>
469 Public method to handle the end of a reformat.
470 </p>
471 <dl>
472
473 <dt><i>src</i> (pathlib.Path)</dt>
474 <dd>
475 name of the processed file
476 </dd>
477 <dt><i>changed</i> (black.Changed)</dt>
478 <dd>
479 change status
480 </dd>
481 <dt><i>diff</i> (str)</dt>
482 <dd>
483 unified diff of potential changes (defaults to "")
484 </dd>
485 </dl>
486 <a NAME="BlackMultiprocessingReport.failed" ID="BlackMultiprocessingReport.failed"></a>
487 <h4>BlackMultiprocessingReport.failed</h4>
488 <b>failed</b>(<i>src, message</i>)
489
490 <p>
491 Public method to handle a reformat failure.
492 </p>
493 <dl>
494
495 <dt><i>src</i> (pathlib.Path)</dt>
496 <dd>
497 name of the processed file
498 </dd>
499 <dt><i>message</i> (str)</dt>
500 <dd>
501 error message
502 </dd>
503 </dl>
504 <a NAME="BlackMultiprocessingReport.path_ignored" ID="BlackMultiprocessingReport.path_ignored"></a>
505 <h4>BlackMultiprocessingReport.path_ignored</h4>
506 <b>path_ignored</b>(<i>src, message=""</i>)
507
508 <p>
509 Public method handling an ignored path.
510 </p>
511 <dl>
512
513 <dt><i>src</i> (pathlib.Path or str)</dt>
514 <dd>
515 name of the processed file
516 </dd>
517 <dt><i>message</i> (str (optional))</dt>
518 <dd>
519 ignore message (default to "")
520 </dd>
521 </dl>
522 <div align="right"><a href="#top">Up</a></div>
523 <hr />
524 <hr />
525 <a NAME="BlackMultiprocessingResult" ID="BlackMultiprocessingResult"></a>
526 <h2>BlackMultiprocessingResult</h2>
527
528 <p>
529 Class containing the reformatting result data.
530 </p>
531 <p>
532 This class is used when reformatting multiple files in parallel using processes.
533 </p>
534 <h3>Derived from</h3>
535 None
536 <h3>Class Attributes</h3>
537
538 <table>
539 <tr><td>None</td></tr>
540 </table>
541 <h3>Class Methods</h3>
542
543 <table>
544 <tr><td>None</td></tr>
545 </table>
546 <h3>Methods</h3>
547
548 <table>
549 <tr><td>None</td></tr>
550 </table>
551 <h3>Static Methods</h3>
552
553 <table>
554 <tr><td>None</td></tr>
555 </table>
556
557 <div align="right"><a href="#top">Up</a></div>
558 <hr />
559 <hr />
560 <a NAME="BlackReport" ID="BlackReport"></a>
561 <h2>BlackReport</h2>
562
563 <p>
564 Class extending the black Report to work with our dialog.
565 </p>
566 <h3>Signals</h3>
567 <dl>
568
569 <dt>result(status, file name, data)</dt>
570 <dd>
571 emitted to signal the reformatting result
572 as three strings giving the status (one of 'changed', 'unchanged', 'unmodified',
573 'failed' or 'ignored'), the file name and data related to the result
574 </dd>
575 </dl>
576 <h3>Derived from</h3>
577 QObject, black.Report
578 <h3>Class Attributes</h3>
579
580 <table>
581 <tr><td>None</td></tr>
582 </table>
583 <h3>Class Methods</h3>
584
585 <table>
586 <tr><td>None</td></tr>
587 </table>
588 <h3>Methods</h3>
589
590 <table>
591
592 <tr>
364 <td><a href="#BlackReport.__init__">BlackReport</a></td> 593 <td><a href="#BlackReport.__init__">BlackReport</a></td>
365 <td>Constructor</td> 594 <td>Constructor</td>
366 </tr> 595 </tr>
367 <tr> 596 <tr>
368 <td><a href="#BlackReport.done">done</a></td> 597 <td><a href="#BlackReport.done">done</a></td>
383 <tr><td>None</td></tr> 612 <tr><td>None</td></tr>
384 </table> 613 </table>
385 614
386 <a NAME="BlackReport.__init__" ID="BlackReport.__init__"></a> 615 <a NAME="BlackReport.__init__" ID="BlackReport.__init__"></a>
387 <h4>BlackReport (Constructor)</h4> 616 <h4>BlackReport (Constructor)</h4>
388 <b>BlackReport</b>(<i>dialog</i>) 617 <b>BlackReport</b>(<i>parent=None</i>)
389 618
390 <p> 619 <p>
391 Constructor 620 Constructor
392 </p> 621 </p>
393 <dl> 622 <dl>
394 623
395 <dt><i>dialog</i> (QDialog)</dt> 624 <dt><i>parent</i> (QObject (optional))</dt>
396 <dd> 625 <dd>
397 reference to the result dialog 626 reference to the parent object (defaults to None
398 </dd> 627 </dd>
399 </dl> 628 </dl>
400 <a NAME="BlackReport.done" ID="BlackReport.done"></a> 629 <a NAME="BlackReport.done" ID="BlackReport.done"></a>
401 <h4>BlackReport.done</h4> 630 <h4>BlackReport.done</h4>
402 <b>done</b>(<i>src, changed, diff=""</i>) 631 <b>done</b>(<i>src, changed, diff=""</i>)
455 ignore message (default to "") 684 ignore message (default to "")
456 </dd> 685 </dd>
457 </dl> 686 </dl>
458 <div align="right"><a href="#top">Up</a></div> 687 <div align="right"><a href="#top">Up</a></div>
459 <hr /> 688 <hr />
689 <hr />
690 <a NAME="BlackStatistics" ID="BlackStatistics"></a>
691 <h2>BlackStatistics</h2>
692
693 <p>
694 Class containing the reformatting statistic data.
695 </p>
696 <h3>Derived from</h3>
697 None
698 <h3>Class Attributes</h3>
699
700 <table>
701 <tr><td>None</td></tr>
702 </table>
703 <h3>Class Methods</h3>
704
705 <table>
706 <tr><td>None</td></tr>
707 </table>
708 <h3>Methods</h3>
709
710 <table>
711 <tr><td>None</td></tr>
712 </table>
713 <h3>Static Methods</h3>
714
715 <table>
716 <tr><td>None</td></tr>
717 </table>
718
719 <div align="right"><a href="#top">Up</a></div>
720 <hr />
460 </body></html> 721 </body></html>

eric ide

mercurial