Sun, 20 Sep 2015 12:16:27 +0200
Added a context menu to the result list of the cyclomatic complexity dialog.
<!DOCTYPE html> <html><head> <title>Plugin_Metrics_Radon.RadonMetrics.radon.raw</title> <meta charset="UTF-8"> <style> body { background: #EDECE6; margin: 0em 1em 10em 1em; color: black; } h1 { color: white; background: #85774A; } h2 { color: white; background: #85774A; } h3 { color: white; background: #9D936E; } h4 { color: white; background: #9D936E; } a { color: #BA6D36; } </style> </head> <body><a NAME="top" ID="top"></a> <h1>Plugin_Metrics_Radon.RadonMetrics.radon.raw</h1> <h3>Global Attributes</h3> <table> <tr><td>COMMENT</td></tr><tr><td>EM</td></tr><tr><td>Module</td></tr><tr><td>NL</td></tr><tr><td>OP</td></tr><tr><td>TOKEN_NUMBER</td></tr><tr><td>__all__</td></tr> </table> <h3>Classes</h3> <table> <tr><td>None</td></tr> </table> <h3>Functions</h3> <table> <tr> <td><a href="#_find">_find</a></td> <td>Return the position of the last token with the same (token, value) pair supplied.</td> </tr><tr> <td><a href="#_generate">_generate</a></td> <td>Pass the code into `tokenize.generate_tokens` and convert the result into a list.</td> </tr><tr> <td><a href="#_get_all_tokens">_get_all_tokens</a></td> <td>Starting from *line*, generate the necessary tokens which represent the shortest tokenization possible.</td> </tr><tr> <td><a href="#_less_tokens">_less_tokens</a></td> <td>Process the output of `tokenize.generate_tokens` removing the tokens specified in `remove`.</td> </tr><tr> <td><a href="#_logical">_logical</a></td> <td>Find how many logical lines are there in the current line.</td> </tr><tr> <td><a href="#_split_tokens">_split_tokens</a></td> <td>Split a list of tokens on the specified token pair (token, value), where *token* is the token type (i.e.</td> </tr><tr> <td><a href="#analyze">analyze</a></td> <td>Analyze the source code and return a namedtuple with the following fields:</td> </tr><tr> <td><a href="#aux">aux</a></td> <td>The actual function which does the job.</td> </tr> </table> <hr /><hr /> <a NAME="_find" ID="_find"></a> <h2>_find</h2> <b>_find</b>(<i>tokens, token, value</i>) <p> Return the position of the last token with the same (token, value) pair supplied. The position is the one of the rightmost term. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="_generate" ID="_generate"></a> <h2>_generate</h2> <b>_generate</b>(<i>code</i>) <p> Pass the code into `tokenize.generate_tokens` and convert the result into a list. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="_get_all_tokens" ID="_get_all_tokens"></a> <h2>_get_all_tokens</h2> <b>_get_all_tokens</b>(<i>line, lines</i>) <p> Starting from *line*, generate the necessary tokens which represent the shortest tokenization possible. This is done by catching :exc:`tokenize.TokenError` when a multi-line string or statement is encountered. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="_less_tokens" ID="_less_tokens"></a> <h2>_less_tokens</h2> <b>_less_tokens</b>(<i>tokens, remove</i>) <p> Process the output of `tokenize.generate_tokens` removing the tokens specified in `remove`. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="_logical" ID="_logical"></a> <h2>_logical</h2> <b>_logical</b>(<i>tokens</i>) <p> Find how many logical lines are there in the current line. </p><p> Normally 1 line of code is equivalent to 1 logical line of code, but there are cases when this is not true. For example:: </p><p> if cond: return 0 </p><p> this line actually corresponds to 2 logical lines, since it can be translated into:: </p><p> if cond: return 0 </p><p> Examples:: </p><p> if cond: -> 1 </p><p> if cond: return 0 -> 2 </p><p> try: 1/0 -> 2 </p><p> try: -> 1 </p><p> if cond: # Only a comment -> 1 </p><p> if cond: return 0 # Only a comment -> 2 </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="_split_tokens" ID="_split_tokens"></a> <h2>_split_tokens</h2> <b>_split_tokens</b>(<i>tokens, token, value</i>) <p> Split a list of tokens on the specified token pair (token, value), where *token* is the token type (i.e. its code) and *value* its actual value in the code. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="analyze" ID="analyze"></a> <h2>analyze</h2> <b>analyze</b>(<i>source</i>) <p> Analyze the source code and return a namedtuple with the following fields: </p><p> * **loc**: The number of lines of code (total) * **lloc**: The number of logical lines of code * **sloc**: The number of source lines of code (not necessarily corresponding to the LLOC) * **comments**: The number of Python comment lines * **multi**: The number of lines which represent multi-line strings * **blank**: The number of blank lines (or whitespace-only ones) </p><p> The equation :math:`sloc + blanks = loc` should always hold. Multiline strings are not counted as comments, since, to the Python interpreter, they are not comments but strings. </p> <div align="right"><a href="#top">Up</a></div> <hr /><hr /> <a NAME="aux" ID="aux"></a> <h2>aux</h2> <b>aux</b>(<i>sub_tokens</i>) <p> The actual function which does the job. </p> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>