diff -r 892c1787d666 -r edde1fe80b3e Documentation/Source/eric5.DataViews.CodeMetrics.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Documentation/Source/eric5.DataViews.CodeMetrics.html Sat Jan 02 18:19:35 2010 +0000 @@ -0,0 +1,309 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' +'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> +<html><head> +<title>eric5.DataViews.CodeMetrics</title> +<style> +b'body {\n background:white;\n margin: 0em 1em 10em 1em;\n color: black;\n}\n\nh1 { color: white; background: #4FA4FF; }\nh2 { color: white; background: #4FA4FF; }\nh3 { color: white; background: #00557F; }\nh4 { color: white; background: #00557F; }\n \na { color: #AA5500; }\n' +</style> +</head> +<body><a NAME="top" ID="top"></a> +<h1>eric5.DataViews.CodeMetrics</h1> +<p> +Module implementing a simple Python code metrics analyzer. +</p><dl> +<dt>Raises <b>ValueError</b>:</dt> +<dd> +the tokenize module is too old +</dd> +</dl> +<h3>Global Attributes</h3> +<table> +<tr><td>COMMENT</td></tr><tr><td>DEDENT</td></tr><tr><td>EMPTY</td></tr><tr><td>INDENT</td></tr><tr><td>KEYWORD</td></tr><tr><td>NEWLINE</td></tr><tr><td>spacer</td></tr> +</table> +<h3>Classes</h3> +<table> +<tr> +<td><a href="#Parser">Parser</a></td> +<td>Class used to parse the source code of a Python file.</td> +</tr><tr> +<td><a href="#SourceStat">SourceStat</a></td> +<td>Class used to calculate and store the source code statistics.</td> +</tr><tr> +<td><a href="#Token">Token</a></td> +<td>Class to store the token related infos.</td> +</tr> +</table> +<h3>Functions</h3> +<table> +<tr> +<td><a href="#analyze">analyze</a></td> +<td>Module function used analyze the source of a Python file.</td> +</tr><tr> +<td><a href="#main">main</a></td> +<td>Modules main function used when called as a script.</td> +</tr><tr> +<td><a href="#summarize">summarize</a></td> +<td>Module function used to collect overall statistics.</td> +</tr> +</table> +<hr /><hr /> +<a NAME="Parser" ID="Parser"></a> +<h2>Parser</h2> +<p> + Class used to parse the source code of a Python file. +</p> +<h3>Derived from</h3> +object +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#Parser.__addToken">__addToken</a></td> +<td>Private method used to add a token to our list of tokens.</td> +</tr><tr> +<td><a href="#Parser.parse">parse</a></td> +<td>Public method used to parse the source code.</td> +</tr> +</table> +<a NAME="Parser.__addToken" ID="Parser.__addToken"></a> +<h4>Parser.__addToken</h4> +<b>__addToken</b>(<i>toktype, toktext, srow, scol, line</i>) +<p> + Private method used to add a token to our list of tokens. +</p><dl> +<dt><i>toktype</i></dt> +<dd> +the type of the token (int) +</dd><dt><i>toktext</i></dt> +<dd> +the text of the token (string) +</dd><dt><i>srow</i></dt> +<dd> +starting row of the token (int) +</dd><dt><i>scol</i></dt> +<dd> +starting column of the token (int) +</dd><dt><i>line</i></dt> +<dd> +logical line the token was found (string) +</dd> +</dl><a NAME="Parser.parse" ID="Parser.parse"></a> +<h4>Parser.parse</h4> +<b>parse</b>(<i>text</i>) +<p> + Public method used to parse the source code. +</p><dl> +<dt><i>text</i></dt> +<dd> +the source code as read from a Python source file +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="SourceStat" ID="SourceStat"></a> +<h2>SourceStat</h2> +<p> + Class used to calculate and store the source code statistics. +</p> +<h3>Derived from</h3> +object +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#SourceStat.__init__">SourceStat</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#SourceStat.dedent">dedent</a></td> +<td>Public method used to decrement the indentation level.</td> +</tr><tr> +<td><a href="#SourceStat.dump">dump</a></td> +<td>Public method used to format and print the collected statistics.</td> +</tr><tr> +<td><a href="#SourceStat.getCounter">getCounter</a></td> +<td>Public method used to get a specific counter value.</td> +</tr><tr> +<td><a href="#SourceStat.inc">inc</a></td> +<td>Public method used to increment the value of a key.</td> +</tr><tr> +<td><a href="#SourceStat.indent">indent</a></td> +<td>Public method used to increment the indentation level.</td> +</tr><tr> +<td><a href="#SourceStat.push">push</a></td> +<td>Public method used to store an identifier.</td> +</tr> +</table> +<a NAME="SourceStat.__init__" ID="SourceStat.__init__"></a> +<h4>SourceStat (Constructor)</h4> +<b>SourceStat</b>(<i></i>) +<p> + Constructor +</p><a NAME="SourceStat.dedent" ID="SourceStat.dedent"></a> +<h4>SourceStat.dedent</h4> +<b>dedent</b>(<i>tok</i>) +<p> + Public method used to decrement the indentation level. +</p><dl> +<dt><i>tok</i></dt> +<dd> +the token to be processed (Token) +</dd> +</dl><a NAME="SourceStat.dump" ID="SourceStat.dump"></a> +<h4>SourceStat.dump</h4> +<b>dump</b>(<i></i>) +<p> + Public method used to format and print the collected statistics. +</p><a NAME="SourceStat.getCounter" ID="SourceStat.getCounter"></a> +<h4>SourceStat.getCounter</h4> +<b>getCounter</b>(<i>id, key</i>) +<p> + Public method used to get a specific counter value. +</p><dl> +<dt><i>id</i></dt> +<dd> +id of the counter (string) +</dd><dt><i>key</i></dt> +<dd> +key of the value to be retrieved (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +the value of the requested counter (int) +</dd> +</dl><a NAME="SourceStat.inc" ID="SourceStat.inc"></a> +<h4>SourceStat.inc</h4> +<b>inc</b>(<i>key, value=1</i>) +<p> + Public method used to increment the value of a key. +</p><dl> +<dt><i>key</i></dt> +<dd> +the key to be incremented +</dd><dt><i>value</i></dt> +<dd> +the increment (int) +</dd> +</dl><a NAME="SourceStat.indent" ID="SourceStat.indent"></a> +<h4>SourceStat.indent</h4> +<b>indent</b>(<i>tok</i>) +<p> + Public method used to increment the indentation level. +</p><dl> +<dt><i>tok</i></dt> +<dd> +a token (Token, ignored) +</dd> +</dl><a NAME="SourceStat.push" ID="SourceStat.push"></a> +<h4>SourceStat.push</h4> +<b>push</b>(<i>identifier, row</i>) +<p> + Public method used to store an identifier. +</p><dl> +<dt><i>identifier</i></dt> +<dd> +the identifier to be remembered (string) +</dd><dt><i>row</i></dt> +<dd> +the row, the identifier is defined in (int) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="Token" ID="Token"></a> +<h2>Token</h2> +<p> + Class to store the token related infos. +</p> +<h3>Derived from</h3> +object +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#Token.__init__">Token</a></td> +<td>Constructor</td> +</tr> +</table> +<a NAME="Token.__init__" ID="Token.__init__"></a> +<h4>Token (Constructor)</h4> +<b>Token</b>(<i>**kw</i>) +<p> + Constructor +</p><dl> +<dt><i>**kw</i></dt> +<dd> +list of key, value pairs +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="analyze" ID="analyze"></a> +<h2>analyze</h2> +<b>analyze</b>(<i>filename, total</i>) +<p> + +</p><p> + Module function used analyze the source of a Python file. +</p><dl> +<dt><i>filename</i></dt> +<dd> +name of the Python file to be analyzed (string) +</dd><dt><i>total</i></dt> +<dd> +dictionary receiving the overall code statistics +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +a statistics object with the collected code statistics (SourceStat) +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="main" ID="main"></a> +<h2>main</h2> +<b>main</b>(<i></i>) +<p> + Modules main function used when called as a script. +</p><p> + This function simply loops over all files given on the commandline + and collects the individual and overall source code statistics. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="summarize" ID="summarize"></a> +<h2>summarize</h2> +<b>summarize</b>(<i>total, key, value</i>) +<p> + Module function used to collect overall statistics. +</p><dl> +<dt><i>total</i></dt> +<dd> +the dictionary for the overall statistics +</dd><dt><i>key</i></dt> +<dd> +the key to be summarize +</dd><dt><i>value</i></dt> +<dd> +the value to be added to the overall statistics +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +the value added to the overall statistics +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file