diff -r 7742e0b96629 -r f6db8b3ecea9 eric6/Documentation/Source/eric6.PipInterface.PipPackagesWidget.html --- a/eric6/Documentation/Source/eric6.PipInterface.PipPackagesWidget.html Sun Feb 07 17:34:51 2021 +0100 +++ b/eric6/Documentation/Source/eric6.PipInterface.PipPackagesWidget.html Mon Feb 08 18:01:02 2021 +0100 @@ -38,6 +38,10 @@ <td><a href="#PipPackagesWidget">PipPackagesWidget</a></td> <td>Class implementing the pip packages management widget.</td> </tr> +<tr> +<td><a href="#PypiSearchResultsParser">PypiSearchResultsParser</a></td> +<td>Class implementing the parser for the PyPI search result page.</td> +</tr> </table> <h3>Functions</h3> @@ -57,7 +61,7 @@ <h3>Class Attributes</h3> <table> -<tr><td>SearchStopwords</td></tr><tr><td>SearchVersionRole</td></tr><tr><td>ShowProcessClassifiersMode</td></tr><tr><td>ShowProcessEntryPointsMode</td></tr><tr><td>ShowProcessFilesListMode</td></tr><tr><td>ShowProcessGeneralMode</td></tr> +<tr><td>SearchUrl</td></tr><tr><td>SearchVersionRole</td></tr><tr><td>ShowProcessClassifiersMode</td></tr><tr><td>ShowProcessEntryPointsMode</td></tr><tr><td>ShowProcessFilesListMode</td></tr><tr><td>ShowProcessGeneralMode</td></tr> </table> <h3>Class Methods</h3> @@ -149,10 +153,6 @@ <td>Private method to get a list of environments and populate the selector.</td> </tr> <tr> -<td><a href="#PipPackagesWidget.__processSearchResult">__processSearchResult</a></td> -<td>Private method to process the search result data from PyPI.</td> -</tr> -<tr> <td><a href="#PipPackagesWidget.__purgeCache">__purgeCache</a></td> <td>Private slot to empty the pip cache.</td> </tr> @@ -169,16 +169,12 @@ <td>Private slot to repair the pip installation of the selected environment.</td> </tr> <tr> -<td><a href="#PipPackagesWidget.__score">__score</a></td> -<td>Private method to calculate some score for a search result.</td> +<td><a href="#PipPackagesWidget.__search">__search</a></td> +<td>Private method to perform the search by calling the PyPI search URL.</td> </tr> <tr> -<td><a href="#PipPackagesWidget.__search">__search</a></td> -<td>Private method to perform the search.</td> -</tr> -<tr> -<td><a href="#PipPackagesWidget.__searchError">__searchError</a></td> -<td>Private method handling a search error.</td> +<td><a href="#PipPackagesWidget.__searchResponse">__searchResponse</a></td> +<td>Private method to extract the search result data from the response.</td> </tr> <tr> <td><a href="#PipPackagesWidget.__selectedUpdateableItems">__selectedUpdateableItems</a></td> @@ -201,10 +197,6 @@ <td>Private slot to show details about the selected search result package.</td> </tr> <tr> -<td><a href="#PipPackagesWidget.__transformHits">__transformHits</a></td> -<td>Private method to convert the list returned from pypi into a packages list.</td> -</tr> -<tr> <td><a href="#PipPackagesWidget.__uninstallRequirements">__uninstallRequirements</a></td> <td>Private slot to uninstall packages as given in a requirements file.</td> </tr> @@ -269,14 +261,6 @@ <td>Private slot handling a change of the search term.</td> </tr> <tr> -<td><a href="#PipPackagesWidget.on_searchEditSummary_returnPressed">on_searchEditSummary_returnPressed</a></td> -<td>Private slot initiating a search via a press of the Return key.</td> -</tr> -<tr> -<td><a href="#PipPackagesWidget.on_searchEditSummary_textChanged">on_searchEditSummary_textChanged</a></td> -<td>Private slot handling a change of the search term.</td> -</tr> -<tr> <td><a href="#PipPackagesWidget.on_searchResultList_itemActivated">on_searchResultList_itemActivated</a></td> <td>Private slot reacting on an search result item activation.</td> </tr> @@ -547,20 +531,6 @@ <p> Private method to get a list of environments and populate the selector. </p> -<a NAME="PipPackagesWidget.__processSearchResult" ID="PipPackagesWidget.__processSearchResult"></a> -<h4>PipPackagesWidget.__processSearchResult</h4> -<b>__processSearchResult</b>(<i>data</i>) - -<p> - Private method to process the search result data from PyPI. -</p> -<dl> - -<dt><i>data</i> (tuple)</dt> -<dd> -result data with hits in the first element -</dd> -</dl> <a NAME="PipPackagesWidget.__purgeCache" ID="PipPackagesWidget.__purgeCache"></a> <h4>PipPackagesWidget.__purgeCache</h4> <b>__purgeCache</b>(<i></i>) @@ -590,59 +560,25 @@ Private slot to repair the pip installation of the selected environment. </p> -<a NAME="PipPackagesWidget.__score" ID="PipPackagesWidget.__score"></a> -<h4>PipPackagesWidget.__score</h4> -<b>__score</b>(<i>name, summary</i>) - -<p> - Private method to calculate some score for a search result. -</p> -<dl> - -<dt><i>name</i> (str)</dt> -<dd> -name of the returned package -</dd> -<dt><i>summary</i> (str)</dt> -<dd> -summary text for the package -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -score value -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -int -</dd> -</dl> <a NAME="PipPackagesWidget.__search" ID="PipPackagesWidget.__search"></a> <h4>PipPackagesWidget.__search</h4> <b>__search</b>(<i></i>) <p> - Private method to perform the search. + Private method to perform the search by calling the PyPI search URL. </p> -<a NAME="PipPackagesWidget.__searchError" ID="PipPackagesWidget.__searchError"></a> -<h4>PipPackagesWidget.__searchError</h4> -<b>__searchError</b>(<i>errorCode, errorString</i>) +<a NAME="PipPackagesWidget.__searchResponse" ID="PipPackagesWidget.__searchResponse"></a> +<h4>PipPackagesWidget.__searchResponse</h4> +<b>__searchResponse</b>(<i>reply</i>) <p> - Private method handling a search error. + Private method to extract the search result data from the response. </p> <dl> -<dt><i>errorCode</i> (int)</dt> +<dt><i>reply</i> (QNetworkReply)</dt> <dd> -code of the error -</dd> -<dt><i>errorString</i> (str)</dt> -<dd> -error message +reference to the reply object containing the data </dd> </dl> <a NAME="PipPackagesWidget.__selectedUpdateableItems" ID="PipPackagesWidget.__selectedUpdateableItems"></a> @@ -710,33 +646,6 @@ reference to the search result item to show details for </dd> </dl> -<a NAME="PipPackagesWidget.__transformHits" ID="PipPackagesWidget.__transformHits"></a> -<h4>PipPackagesWidget.__transformHits</h4> -<b>__transformHits</b>(<i>hits</i>) - -<p> - Private method to convert the list returned from pypi into a - packages list. -</p> -<dl> - -<dt><i>hits</i> (list of dict)</dt> -<dd> -list returned from pypi -</dd> -</dl> -<dl> -<dt>Return:</dt> -<dd> -list of packages -</dd> -</dl> -<dl> -<dt>Return Type:</dt> -<dd> -list of dict -</dd> -</dl> <a NAME="PipPackagesWidget.__uninstallRequirements" ID="PipPackagesWidget.__uninstallRequirements"></a> <h4>PipPackagesWidget.__uninstallRequirements</h4> <b>__uninstallRequirements</b>(<i></i>) @@ -896,27 +805,6 @@ search term </dd> </dl> -<a NAME="PipPackagesWidget.on_searchEditSummary_returnPressed" ID="PipPackagesWidget.on_searchEditSummary_returnPressed"></a> -<h4>PipPackagesWidget.on_searchEditSummary_returnPressed</h4> -<b>on_searchEditSummary_returnPressed</b>(<i></i>) - -<p> - Private slot initiating a search via a press of the Return key. -</p> -<a NAME="PipPackagesWidget.on_searchEditSummary_textChanged" ID="PipPackagesWidget.on_searchEditSummary_textChanged"></a> -<h4>PipPackagesWidget.on_searchEditSummary_textChanged</h4> -<b>on_searchEditSummary_textChanged</b>(<i>txt</i>) - -<p> - Private slot handling a change of the search term. -</p> -<dl> - -<dt><i>txt</i> (str)</dt> -<dd> -search term -</dd> -</dl> <a NAME="PipPackagesWidget.on_searchResultList_itemActivated" ID="PipPackagesWidget.on_searchResultList_itemActivated"></a> <h4>PipPackagesWidget.on_searchResultList_itemActivated</h4> <b>on_searchResultList_itemActivated</b>(<i>item, column</i>) @@ -1022,4 +910,197 @@ </dl> <div align="right"><a href="#top">Up</a></div> <hr /> +<hr /> +<a NAME="PypiSearchResultsParser" ID="PypiSearchResultsParser"></a> +<h2>PypiSearchResultsParser</h2> + +<p> + Class implementing the parser for the PyPI search result page. +</p> +<h3>Derived from</h3> +html.parser.HTMLParser +<h3>Class Attributes</h3> + +<table> +<tr><td>ClassPrefix</td></tr> +</table> +<h3>Class Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> + +<table> + +<tr> +<td><a href="#PypiSearchResultsParser.__init__">PypiSearchResultsParser</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#PypiSearchResultsParser.__getClass">__getClass</a></td> +<td>Private method to extract the class attribute out of the list of attributes.</td> +</tr> +<tr> +<td><a href="#PypiSearchResultsParser.__getDate">__getDate</a></td> +<td>Private method to extract the datetime attribute out of the list of attributes and process it.</td> +</tr> +<tr> +<td><a href="#PypiSearchResultsParser.getResults">getResults</a></td> +<td>Public method to get the extracted search results.</td> +</tr> +<tr> +<td><a href="#PypiSearchResultsParser.handle_data">handle_data</a></td> +<td>Public method process arbitrary data.</td> +</tr> +<tr> +<td><a href="#PypiSearchResultsParser.handle_endtag">handle_endtag</a></td> +<td>Public method to process the end tag.</td> +</tr> +<tr> +<td><a href="#PypiSearchResultsParser.handle_starttag">handle_starttag</a></td> +<td>Public method to process the start tag.</td> +</tr> +</table> +<h3>Static Methods</h3> + +<table> +<tr><td>None</td></tr> +</table> + +<a NAME="PypiSearchResultsParser.__init__" ID="PypiSearchResultsParser.__init__"></a> +<h4>PypiSearchResultsParser (Constructor)</h4> +<b>PypiSearchResultsParser</b>(<i>data</i>) + +<p> + Constructor +</p> +<dl> + +<dt><i>data</i> (str)</dt> +<dd> +data to be parsed +</dd> +</dl> +<a NAME="PypiSearchResultsParser.__getClass" ID="PypiSearchResultsParser.__getClass"></a> +<h4>PypiSearchResultsParser.__getClass</h4> +<b>__getClass</b>(<i>attrs</i>) + +<p> + Private method to extract the class attribute out of the list of + attributes. +</p> +<dl> + +<dt><i>attrs</i> (list of tuple of (str, str))</dt> +<dd> +list of tag attributes as (name, value) tuples +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the 'class' attribute or None +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="PypiSearchResultsParser.__getDate" ID="PypiSearchResultsParser.__getDate"></a> +<h4>PypiSearchResultsParser.__getDate</h4> +<b>__getDate</b>(<i>attrs</i>) + +<p> + Private method to extract the datetime attribute out of the list of + attributes and process it. +</p> +<dl> + +<dt><i>attrs</i> (list of tuple of (str, str))</dt> +<dd> +list of tag attributes as (name, value) tuples +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +value of the 'class' attribute or None +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="PypiSearchResultsParser.getResults" ID="PypiSearchResultsParser.getResults"></a> +<h4>PypiSearchResultsParser.getResults</h4> +<b>getResults</b>(<i></i>) + +<p> + Public method to get the extracted search results. +</p> +<dl> +<dt>Return:</dt> +<dd> +extracted result data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list of dict +</dd> +</dl> +<a NAME="PypiSearchResultsParser.handle_data" ID="PypiSearchResultsParser.handle_data"></a> +<h4>PypiSearchResultsParser.handle_data</h4> +<b>handle_data</b>(<i>data</i>) + +<p> + Public method process arbitrary data. +</p> +<dl> + +<dt><i>data</i> (str)</dt> +<dd> +data to be processed +</dd> +</dl> +<a NAME="PypiSearchResultsParser.handle_endtag" ID="PypiSearchResultsParser.handle_endtag"></a> +<h4>PypiSearchResultsParser.handle_endtag</h4> +<b>handle_endtag</b>(<i>tag</i>) + +<p> + Public method to process the end tag. +</p> +<dl> + +<dt><i>tag</i> (str)</dt> +<dd> +tag name (all lowercase) +</dd> +</dl> +<a NAME="PypiSearchResultsParser.handle_starttag" ID="PypiSearchResultsParser.handle_starttag"></a> +<h4>PypiSearchResultsParser.handle_starttag</h4> +<b>handle_starttag</b>(<i>tag, attrs</i>) + +<p> + Public method to process the start tag. +</p> +<dl> + +<dt><i>tag</i> (str)</dt> +<dd> +tag name (all lowercase) +</dd> +<dt><i>attrs</i> (list of tuple of (str, str))</dt> +<dd> +list of tag attributes as (name, value) tuples +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> </body></html> \ No newline at end of file