--- a/src/eric7/Documentation/Source/eric7.CodeFormatting.BlackFormattingDialog.html Tue Aug 23 19:33:07 2022 +0200 +++ b/src/eric7/Documentation/Source/eric7.CodeFormatting.BlackFormattingDialog.html Tue Aug 23 19:35:42 2022 +0200 @@ -25,9 +25,21 @@ <td>Class implementing a dialog showing the code formatting progress and the result.</td> </tr> <tr> +<td><a href="#BlackMultiprocessingReport">BlackMultiprocessingReport</a></td> +<td>Class extending the black Report to work with multiprocessing.</td> +</tr> +<tr> +<td><a href="#BlackMultiprocessingResult">BlackMultiprocessingResult</a></td> +<td>Class containing the reformatting result data.</td> +</tr> +<tr> <td><a href="#BlackReport">BlackReport</a></td> <td>Class extending the black Report to work with our dialog.</td> </tr> +<tr> +<td><a href="#BlackStatistics">BlackStatistics</a></td> +<td>Class containing the reformatting statistic data.</td> +</tr> </table> <h3>Functions</h3> @@ -63,10 +75,6 @@ <td>Constructor</td> </tr> <tr> -<td><a href="#BlackFormattingDialog.__diffFormatFile">__diffFormatFile</a></td> -<td>Private method to check, if the given files need to be reformatted, and generate a unified diff.</td> -</tr> -<tr> <td><a href="#BlackFormattingDialog.__filterFiles">__filterFiles</a></td> <td>Private method to filter the given list of files according the configuration parameters.</td> </tr> @@ -75,10 +83,18 @@ <td>Private method to perform some actions after the run was performed or canceled.</td> </tr> <tr> -<td><a href="#BlackFormattingDialog.__formatFiles">__formatFiles</a></td> +<td><a href="#BlackFormattingDialog.__formatManyFiles">__formatManyFiles</a></td> +<td>Private method to format the list of files according the configuration using multiple processes in parallel.</td> +</tr> +<tr> +<td><a href="#BlackFormattingDialog.__formatOneFile">__formatOneFile</a></td> <td>Private method to format the list of files according the configuration.</td> </tr> <tr> +<td><a href="#BlackFormattingDialog.__handleBlackFormattingResult">__handleBlackFormattingResult</a></td> +<td>Private slot to handle the result of a black reformatting action.</td> +</tr> +<tr> <td><a href="#BlackFormattingDialog.__populateStatusFilterCombo">__populateStatusFilterCombo</a></td> <td>Private method to populate the status filter combo box with allowed selections.</td> </tr> @@ -95,10 +111,6 @@ <td>Private method to update the statistics about the recent formatting run and make them visible.</td> </tr> <tr> -<td><a href="#BlackFormattingDialog.addResultEntry">addResultEntry</a></td> -<td>Public method to add an entry to the result list.</td> -</tr> -<tr> <td><a href="#BlackFormattingDialog.closeEvent">closeEvent</a></td> <td>Protected slot implementing a close event handler.</td> </tr> @@ -118,7 +130,15 @@ <h3>Static Methods</h3> <table> -<tr><td>None</td></tr> + +<tr> +<td><a href="#BlackFormattingDialog.__diffFormatFile">__diffFormatFile</a></td> +<td>Static method to check, if the given files need to be reformatted, and generate a unified diff.</td> +</tr> +<tr> +<td><a href="#BlackFormattingDialog.formattingWorkerTask">formattingWorkerTask</a></td> +<td>Static method acting as the parallel worker for the formatting task.</td> +</tr> </table> <a NAME="BlackFormattingDialog.__init__" ID="BlackFormattingDialog.__init__"></a> @@ -151,33 +171,6 @@ reference to the parent widget (defaults to None) </dd> </dl> -<a NAME="BlackFormattingDialog.__diffFormatFile" ID="BlackFormattingDialog.__diffFormatFile"></a> -<h4>BlackFormattingDialog.__diffFormatFile</h4> -<b>__diffFormatFile</b>(<i>src, fast, mode, report</i>) - -<p> - Private method to check, if the given files need to be reformatted, and generate - a unified diff. -</p> -<dl> - -<dt><i>src</i> (pathlib.Path)</dt> -<dd> -path of file to be checked -</dd> -<dt><i>fast</i> (bool)</dt> -<dd> -flag indicating fast operation -</dd> -<dt><i>mode</i> (black.Mode)</dt> -<dd> -code formatting options -</dd> -<dt><i>report</i> (BlackReport)</dt> -<dd> -reference to the report object -</dd> -</dl> <a NAME="BlackFormattingDialog.__filterFiles" ID="BlackFormattingDialog.__filterFiles"></a> <h4>BlackFormattingDialog.__filterFiles</h4> <b>__filterFiles</b>(<i>filesList</i>) @@ -212,13 +205,58 @@ <p> Private method to perform some actions after the run was performed or canceled. </p> -<a NAME="BlackFormattingDialog.__formatFiles" ID="BlackFormattingDialog.__formatFiles"></a> -<h4>BlackFormattingDialog.__formatFiles</h4> -<b>__formatFiles</b>(<i></i>) +<a NAME="BlackFormattingDialog.__formatManyFiles" ID="BlackFormattingDialog.__formatManyFiles"></a> +<h4>BlackFormattingDialog.__formatManyFiles</h4> +<b>__formatManyFiles</b>(<i>files</i>) + +<p> + Private method to format the list of files according the configuration using + multiple processes in parallel. +</p> +<dl> + +<dt><i>files</i> (list of str)</dt> +<dd> +list of files to be processed +</dd> +</dl> +<a NAME="BlackFormattingDialog.__formatOneFile" ID="BlackFormattingDialog.__formatOneFile"></a> +<h4>BlackFormattingDialog.__formatOneFile</h4> +<b>__formatOneFile</b>(<i>file</i>) <p> Private method to format the list of files according the configuration. </p> +<dl> + +<dt><i>file</i> (str)</dt> +<dd> +name of the file to be processed +</dd> +</dl> +<a NAME="BlackFormattingDialog.__handleBlackFormattingResult" ID="BlackFormattingDialog.__handleBlackFormattingResult"></a> +<h4>BlackFormattingDialog.__handleBlackFormattingResult</h4> +<b>__handleBlackFormattingResult</b>(<i>status, filename, data</i>) + +<p> + Private slot to handle the result of a black reformatting action. +</p> +<dl> + +<dt><i>status</i> (str)</dt> +<dd> +status of the performed action (one of 'changed', 'unchanged', + 'unmodified', 'failed' or 'ignored') +</dd> +<dt><i>filename</i> (str)</dt> +<dd> +name of the processed file +</dd> +<dt><i>data</i> (str)</dt> +<dd> +action data (error message or unified diff) +</dd> +</dl> <a NAME="BlackFormattingDialog.__populateStatusFilterCombo" ID="BlackFormattingDialog.__populateStatusFilterCombo"></a> <h4>BlackFormattingDialog.__populateStatusFilterCombo</h4> <b>__populateStatusFilterCombo</b>(<i></i>) @@ -248,33 +286,6 @@ Private method to update the statistics about the recent formatting run and make them visible. </p> -<a NAME="BlackFormattingDialog.addResultEntry" ID="BlackFormattingDialog.addResultEntry"></a> -<h4>BlackFormattingDialog.addResultEntry</h4> -<b>addResultEntry</b>(<i>status, fileName, isError=False, data=None</i>) - -<p> - Public method to add an entry to the result list. -</p> -<dl> - -<dt><i>status</i> (str)</dt> -<dd> -status of the operation -</dd> -<dt><i>fileName</i> (str)</dt> -<dd> -name of the processed file -</dd> -<dt><i>isError</i> (bool (optional))</dt> -<dd> -flag indicating that data contains an error message (defaults to - False) -</dd> -<dt><i>data</i> (str (optional))</dt> -<dd> -associated data (diff or error message) (defaults to None) -</dd> -</dl> <a NAME="BlackFormattingDialog.closeEvent" ID="BlackFormattingDialog.closeEvent"></a> <h4>BlackFormattingDialog.closeEvent</h4> <b>closeEvent</b>(<i>evt</i>) @@ -335,6 +346,214 @@ selected status </dd> </dl> +<a NAME="BlackFormattingDialog.__diffFormatFile" ID="BlackFormattingDialog.__diffFormatFile"></a> +<h4>BlackFormattingDialog.__diffFormatFile (static)</h4> +<b>__diffFormatFile</b>(<i>fast, mode, report, relSrc=""</i>) + +<p> + Static method to check, if the given files need to be reformatted, and generate + a unified diff. +</p> +<dl> + +<dt><i>src</i> (pathlib.Path)</dt> +<dd> +path of file to be checked +</dd> +<dt><i>fast</i> (bool)</dt> +<dd> +flag indicating fast operation +</dd> +<dt><i>mode</i> (black.Mode)</dt> +<dd> +code formatting options +</dd> +<dt><i>report</i> (BlackReport)</dt> +<dd> +reference to the report object +</dd> +<dt><i>relSrc</i> (str (optional))</dt> +<dd> +name of the file relative to the project (defaults to "") +</dd> +</dl> +<a NAME="BlackFormattingDialog.formattingWorkerTask" ID="BlackFormattingDialog.formattingWorkerTask"></a> +<h4>BlackFormattingDialog.formattingWorkerTask (static)</h4> +<b>formattingWorkerTask</b>(<i>outputQueue, config</i>) + +<p> + Static method acting as the parallel worker for the formatting task. +</p> +<dl> + +<dt><i>inputQueue</i> (multiprocessing.Queue)</dt> +<dd> +input queue +</dd> +<dt><i>outputQueue</i> (multiprocessing.Queue)</dt> +<dd> +output queue +</dd> +<dt><i>config</i> (dict)</dt> +<dd> +dictionary containing the configuration parameters +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="BlackMultiprocessingReport" ID="BlackMultiprocessingReport"></a> +<h2>BlackMultiprocessingReport</h2> + +<p> + Class extending the black Report to work with multiprocessing. +</p> +<h3>Derived from</h3> +black.Report +<h3>Class Attributes</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> + +<table> + +<tr> +<td><a href="#BlackMultiprocessingReport.__init__">BlackMultiprocessingReport</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#BlackMultiprocessingReport.done">done</a></td> +<td>Public method to handle the end of a reformat.</td> +</tr> +<tr> +<td><a href="#BlackMultiprocessingReport.failed">failed</a></td> +<td>Public method to handle a reformat failure.</td> +</tr> +<tr> +<td><a href="#BlackMultiprocessingReport.path_ignored">path_ignored</a></td> +<td>Public method handling an ignored path.</td> +</tr> +</table> +<h3>Static Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> + +<a NAME="BlackMultiprocessingReport.__init__" ID="BlackMultiprocessingReport.__init__"></a> +<h4>BlackMultiprocessingReport (Constructor)</h4> +<b>BlackMultiprocessingReport</b>(<i>resultQueue</i>) + +<p> + Constructor +</p> +<dl> + +<dt><i>resultQueue</i> (multiprocessing.Queue)</dt> +<dd> +reference to the queue to put the results into +</dd> +</dl> +<a NAME="BlackMultiprocessingReport.done" ID="BlackMultiprocessingReport.done"></a> +<h4>BlackMultiprocessingReport.done</h4> +<b>done</b>(<i>src, changed, diff=""</i>) + +<p> + Public method to handle the end of a reformat. +</p> +<dl> + +<dt><i>src</i> (pathlib.Path)</dt> +<dd> +name of the processed file +</dd> +<dt><i>changed</i> (black.Changed)</dt> +<dd> +change status +</dd> +<dt><i>diff</i> (str)</dt> +<dd> +unified diff of potential changes (defaults to "") +</dd> +</dl> +<a NAME="BlackMultiprocessingReport.failed" ID="BlackMultiprocessingReport.failed"></a> +<h4>BlackMultiprocessingReport.failed</h4> +<b>failed</b>(<i>src, message</i>) + +<p> + Public method to handle a reformat failure. +</p> +<dl> + +<dt><i>src</i> (pathlib.Path)</dt> +<dd> +name of the processed file +</dd> +<dt><i>message</i> (str)</dt> +<dd> +error message +</dd> +</dl> +<a NAME="BlackMultiprocessingReport.path_ignored" ID="BlackMultiprocessingReport.path_ignored"></a> +<h4>BlackMultiprocessingReport.path_ignored</h4> +<b>path_ignored</b>(<i>src, message=""</i>) + +<p> + Public method handling an ignored path. +</p> +<dl> + +<dt><i>src</i> (pathlib.Path or str)</dt> +<dd> +name of the processed file +</dd> +<dt><i>message</i> (str (optional))</dt> +<dd> +ignore message (default to "") +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +<hr /> +<a NAME="BlackMultiprocessingResult" ID="BlackMultiprocessingResult"></a> +<h2>BlackMultiprocessingResult</h2> + +<p> + Class containing the reformatting result data. +</p> +<p> + This class is used when reformatting multiple files in parallel using processes. +</p> +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Static Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> + <div align="right"><a href="#top">Up</a></div> <hr /> <hr /> @@ -344,8 +563,18 @@ <p> Class extending the black Report to work with our dialog. </p> +<h3>Signals</h3> +<dl> + +<dt>result(status, file name, data)</dt> +<dd> +emitted to signal the reformatting result + as three strings giving the status (one of 'changed', 'unchanged', 'unmodified', + 'failed' or 'ignored'), the file name and data related to the result +</dd> +</dl> <h3>Derived from</h3> -black.Report +QObject, black.Report <h3>Class Attributes</h3> <table> @@ -385,16 +614,16 @@ <a NAME="BlackReport.__init__" ID="BlackReport.__init__"></a> <h4>BlackReport (Constructor)</h4> -<b>BlackReport</b>(<i>dialog</i>) +<b>BlackReport</b>(<i>parent=None</i>) <p> Constructor </p> <dl> -<dt><i>dialog</i> (QDialog)</dt> +<dt><i>parent</i> (QObject (optional))</dt> <dd> -reference to the result dialog +reference to the parent object (defaults to None </dd> </dl> <a NAME="BlackReport.done" ID="BlackReport.done"></a> @@ -457,4 +686,36 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /> +<hr /> +<a NAME="BlackStatistics" ID="BlackStatistics"></a> +<h2>BlackStatistics</h2> + +<p> + Class containing the reformatting statistic data. +</p> +<h3>Derived from</h3> +None +<h3>Class Attributes</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Static Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> + +<div align="right"><a href="#top">Up</a></div> +<hr /> </body></html> \ No newline at end of file