Documentation/Source/eric5.DataViews.CodeMetrics.html

changeset 58
37f0444c3479
parent 21
b88a0e6268bd
child 409
0ea528e80202
equal deleted inserted replaced
57:81326a94fdca 58:37f0444c3479
20 </style> 20 </style>
21 </head> 21 </head>
22 <body><a NAME="top" ID="top"></a> 22 <body><a NAME="top" ID="top"></a>
23 <h1>eric5.DataViews.CodeMetrics</h1> 23 <h1>eric5.DataViews.CodeMetrics</h1>
24 <p> 24 <p>
25 &#77;&#111;&#100;&#117;&#108;&#101; &#105;&#109;&#112;&#108;&#101;&#109;&#101;&#110;&#116;&#105;&#110;&#103; &#97; &#115;&#105;&#109;&#112;&#108;&#101; &#80;y&#116;&#104;&#111;&#110; &#99;&#111;&#100;&#101; &#109;&#101;&#116;&#114;&#105;&#99;&#115; &#97;&#110;&#97;&#108;yz&#101;&#114;. 25 Module implementing a simple Python code metrics analyzer.
26 </p><dl> 26 </p><dl>
27 <dt>Raises <b>ValueError</b>:</dt> 27 <dt>Raises <b>ValueError</b>:</dt>
28 <dd> 28 <dd>
29 &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110;&#105;z&#101; &#109;&#111;&#100;&#117;&#108;&#101; &#105;&#115; &#116;&#111;&#111; &#111;&#108;&#100; 29 the tokenize module is too old
30 </dd> 30 </dd>
31 </dl> 31 </dl>
32 <h3>Global Attributes</h3> 32 <h3>Global Attributes</h3>
33 <table> 33 <table>
34 <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> 34 <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>
35 </table> 35 </table>
36 <h3>Classes</h3> 36 <h3>Classes</h3>
37 <table> 37 <table>
38 <tr> 38 <tr>
39 <td><a href="#Parser">Parser</a></td> 39 <td><a href="#Parser">Parser</a></td>
40 <td>&#67;&#108;&#97;&#115;&#115; &#117;&#115;&#101;&#100; &#116;&#111; &#112;&#97;&#114;&#115;&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101; &#111;&#102; &#97; &#80;y&#116;&#104;&#111;&#110; &#102;&#105;&#108;&#101;.</td> 40 <td>Class used to parse the source code of a Python file.</td>
41 </tr><tr> 41 </tr><tr>
42 <td><a href="#SourceStat">SourceStat</a></td> 42 <td><a href="#SourceStat">SourceStat</a></td>
43 <td>&#67;&#108;&#97;&#115;&#115; &#117;&#115;&#101;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97;&#110;&#100; &#115;&#116;&#111;&#114;&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;.</td> 43 <td>Class used to calculate and store the source code statistics.</td>
44 </tr><tr> 44 </tr><tr>
45 <td><a href="#Token">Token</a></td> 45 <td><a href="#Token">Token</a></td>
46 <td>&#67;&#108;&#97;&#115;&#115; &#116;&#111; &#115;&#116;&#111;&#114;&#101; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; &#114;&#101;&#108;&#97;&#116;&#101;&#100; &#105;&#110;&#102;&#111;&#115;.</td> 46 <td>Class to store the token related infos.</td>
47 </tr> 47 </tr>
48 </table> 48 </table>
49 <h3>Functions</h3> 49 <h3>Functions</h3>
50 <table> 50 <table>
51 <tr> 51 <tr>
52 <td><a href="#analyze">analyze</a></td> 52 <td><a href="#analyze">analyze</a></td>
53 <td>&#77;&#111;&#100;&#117;&#108;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#117;&#115;&#101;&#100; &#97;&#110;&#97;&#108;yz&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#111;&#102; &#97; &#80;y&#116;&#104;&#111;&#110; &#102;&#105;&#108;&#101;.</td> 53 <td>Module function used analyze the source of a Python file.</td>
54 </tr><tr> 54 </tr><tr>
55 <td><a href="#main">main</a></td> 55 <td><a href="#main">main</a></td>
56 <td>&#77;&#111;&#100;&#117;&#108;&#101;&#115; &#109;&#97;&#105;&#110; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#117;&#115;&#101;&#100; w&#104;&#101;&#110; &#99;&#97;&#108;&#108;&#101;&#100; &#97;&#115; &#97; &#115;&#99;&#114;&#105;&#112;&#116;.</td> 56 <td>Modules main function used when called as a script.</td>
57 </tr><tr> 57 </tr><tr>
58 <td><a href="#summarize">summarize</a></td> 58 <td><a href="#summarize">summarize</a></td>
59 <td>&#77;&#111;&#100;&#117;&#108;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#117;&#115;&#101;&#100; &#116;&#111; &#99;&#111;&#108;&#108;&#101;&#99;&#116; &#111;v&#101;&#114;&#97;&#108;&#108; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;.</td> 59 <td>Module function used to collect overall statistics.</td>
60 </tr> 60 </tr>
61 </table> 61 </table>
62 <hr /><hr /> 62 <hr /><hr />
63 <a NAME="Parser" ID="Parser"></a> 63 <a NAME="Parser" ID="Parser"></a>
64 <h2>Parser</h2> 64 <h2>Parser</h2>
65 <p> 65 <p>
66 &#67;&#108;&#97;&#115;&#115; &#117;&#115;&#101;&#100; &#116;&#111; &#112;&#97;&#114;&#115;&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101; &#111;&#102; &#97; &#80;y&#116;&#104;&#111;&#110; &#102;&#105;&#108;&#101;. 66 Class used to parse the source code of a Python file.
67 </p> 67 </p>
68 <h3>Derived from</h3> 68 <h3>Derived from</h3>
69 object 69 object
70 <h3>Class Attributes</h3> 70 <h3>Class Attributes</h3>
71 <table> 71 <table>
73 </table> 73 </table>
74 <h3>Methods</h3> 74 <h3>Methods</h3>
75 <table> 75 <table>
76 <tr> 76 <tr>
77 <td><a href="#Parser.__addToken">__addToken</a></td> 77 <td><a href="#Parser.__addToken">__addToken</a></td>
78 <td>&#80;&#114;&#105;v&#97;&#116;&#101; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#97;&#100;&#100; &#97; &#116;&#111;&#107;&#101;&#110; &#116;&#111; &#111;&#117;&#114; &#108;&#105;&#115;&#116; &#111;&#102; &#116;&#111;&#107;&#101;&#110;&#115;.</td> 78 <td>Private method used to add a token to our list of tokens.</td>
79 </tr><tr> 79 </tr><tr>
80 <td><a href="#Parser.parse">parse</a></td> 80 <td><a href="#Parser.parse">parse</a></td>
81 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#112;&#97;&#114;&#115;&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101;.</td> 81 <td>Public method used to parse the source code.</td>
82 </tr> 82 </tr>
83 </table> 83 </table>
84 <a NAME="Parser.__addToken" ID="Parser.__addToken"></a> 84 <a NAME="Parser.__addToken" ID="Parser.__addToken"></a>
85 <h4>Parser.__addToken</h4> 85 <h4>Parser.__addToken</h4>
86 <b>__addToken</b>(<i>toktype, toktext, srow, scol, line</i>) 86 <b>__addToken</b>(<i>toktype, toktext, srow, scol, line</i>)
87 <p> 87 <p>
88 &#80;&#114;&#105;v&#97;&#116;&#101; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#97;&#100;&#100; &#97; &#116;&#111;&#107;&#101;&#110; &#116;&#111; &#111;&#117;&#114; &#108;&#105;&#115;&#116; &#111;&#102; &#116;&#111;&#107;&#101;&#110;&#115;. 88 Private method used to add a token to our list of tokens.
89 </p><dl> 89 </p><dl>
90 <dt><i>toktype</i></dt> 90 <dt><i>toktype</i></dt>
91 <dd> 91 <dd>
92 &#116;&#104;&#101; &#116;y&#112;&#101; &#111;&#102; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; (&#105;&#110;&#116;) 92 the type of the token (int)
93 </dd><dt><i>toktext</i></dt> 93 </dd><dt><i>toktext</i></dt>
94 <dd> 94 <dd>
95 &#116;&#104;&#101; &#116;&#101;x&#116; &#111;&#102; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; (&#115;&#116;&#114;&#105;&#110;&#103;) 95 the text of the token (string)
96 </dd><dt><i>srow</i></dt> 96 </dd><dt><i>srow</i></dt>
97 <dd> 97 <dd>
98 &#115;&#116;&#97;&#114;&#116;&#105;&#110;&#103; &#114;&#111;w &#111;&#102; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; (&#105;&#110;&#116;) 98 starting row of the token (int)
99 </dd><dt><i>scol</i></dt> 99 </dd><dt><i>scol</i></dt>
100 <dd> 100 <dd>
101 &#115;&#116;&#97;&#114;&#116;&#105;&#110;&#103; &#99;&#111;&#108;&#117;&#109;&#110; &#111;&#102; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; (&#105;&#110;&#116;) 101 starting column of the token (int)
102 </dd><dt><i>line</i></dt> 102 </dd><dt><i>line</i></dt>
103 <dd> 103 <dd>
104 &#108;&#111;&#103;&#105;&#99;&#97;&#108; &#108;&#105;&#110;&#101; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; w&#97;&#115; &#102;&#111;&#117;&#110;&#100; (&#115;&#116;&#114;&#105;&#110;&#103;) 104 logical line the token was found (string)
105 </dd> 105 </dd>
106 </dl><a NAME="Parser.parse" ID="Parser.parse"></a> 106 </dl><a NAME="Parser.parse" ID="Parser.parse"></a>
107 <h4>Parser.parse</h4> 107 <h4>Parser.parse</h4>
108 <b>parse</b>(<i>text</i>) 108 <b>parse</b>(<i>text</i>)
109 <p> 109 <p>
110 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#112;&#97;&#114;&#115;&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101;. 110 Public method used to parse the source code.
111 </p><dl> 111 </p><dl>
112 <dt><i>text</i></dt> 112 <dt><i>text</i></dt>
113 <dd> 113 <dd>
114 &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101; &#97;&#115; &#114;&#101;&#97;&#100; &#102;&#114;&#111;&#109; &#97; &#80;y&#116;&#104;&#111;&#110; &#115;&#111;&#117;&#114;&#99;&#101; &#102;&#105;&#108;&#101; 114 the source code as read from a Python source file
115 </dd> 115 </dd>
116 </dl> 116 </dl>
117 <div align="right"><a href="#top">Up</a></div> 117 <div align="right"><a href="#top">Up</a></div>
118 <hr /><hr /> 118 <hr /><hr />
119 <a NAME="SourceStat" ID="SourceStat"></a> 119 <a NAME="SourceStat" ID="SourceStat"></a>
120 <h2>SourceStat</h2> 120 <h2>SourceStat</h2>
121 <p> 121 <p>
122 &#67;&#108;&#97;&#115;&#115; &#117;&#115;&#101;&#100; &#116;&#111; &#99;&#97;&#108;&#99;&#117;&#108;&#97;&#116;&#101; &#97;&#110;&#100; &#115;&#116;&#111;&#114;&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;. 122 Class used to calculate and store the source code statistics.
123 </p> 123 </p>
124 <h3>Derived from</h3> 124 <h3>Derived from</h3>
125 object 125 object
126 <h3>Class Attributes</h3> 126 <h3>Class Attributes</h3>
127 <table> 127 <table>
129 </table> 129 </table>
130 <h3>Methods</h3> 130 <h3>Methods</h3>
131 <table> 131 <table>
132 <tr> 132 <tr>
133 <td><a href="#SourceStat.__init__">SourceStat</a></td> 133 <td><a href="#SourceStat.__init__">SourceStat</a></td>
134 <td>&#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114;</td> 134 <td>Constructor</td>
135 </tr><tr> 135 </tr><tr>
136 <td><a href="#SourceStat.dedent">dedent</a></td> 136 <td><a href="#SourceStat.dedent">dedent</a></td>
137 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#100;&#101;&#99;&#114;&#101;&#109;&#101;&#110;&#116; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;.</td> 137 <td>Public method used to decrement the indentation level.</td>
138 </tr><tr> 138 </tr><tr>
139 <td><a href="#SourceStat.dump">dump</a></td> 139 <td><a href="#SourceStat.dump">dump</a></td>
140 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#102;&#111;&#114;&#109;&#97;&#116; &#97;&#110;&#100; &#112;&#114;&#105;&#110;&#116; &#116;&#104;&#101; &#99;&#111;&#108;&#108;&#101;&#99;&#116;&#101;&#100; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;.</td> 140 <td>Public method used to format and print the collected statistics.</td>
141 </tr><tr> 141 </tr><tr>
142 <td><a href="#SourceStat.getCounter">getCounter</a></td> 142 <td><a href="#SourceStat.getCounter">getCounter</a></td>
143 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#103;&#101;&#116; &#97; &#115;&#112;&#101;&#99;&#105;&#102;&#105;&#99; &#99;&#111;&#117;&#110;&#116;&#101;&#114; v&#97;&#108;&#117;&#101;.</td> 143 <td>Public method used to get a specific counter value.</td>
144 </tr><tr> 144 </tr><tr>
145 <td><a href="#SourceStat.inc">inc</a></td> 145 <td><a href="#SourceStat.inc">inc</a></td>
146 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#105;&#110;&#99;&#114;&#101;&#109;&#101;&#110;&#116; &#116;&#104;&#101; v&#97;&#108;&#117;&#101; &#111;&#102; &#97; &#107;&#101;y.</td> 146 <td>Public method used to increment the value of a key.</td>
147 </tr><tr> 147 </tr><tr>
148 <td><a href="#SourceStat.indent">indent</a></td> 148 <td><a href="#SourceStat.indent">indent</a></td>
149 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#105;&#110;&#99;&#114;&#101;&#109;&#101;&#110;&#116; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;.</td> 149 <td>Public method used to increment the indentation level.</td>
150 </tr><tr> 150 </tr><tr>
151 <td><a href="#SourceStat.push">push</a></td> 151 <td><a href="#SourceStat.push">push</a></td>
152 <td>&#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#115;&#116;&#111;&#114;&#101; &#97;&#110; &#105;&#100;&#101;&#110;&#116;&#105;&#102;&#105;&#101;&#114;.</td> 152 <td>Public method used to store an identifier.</td>
153 </tr> 153 </tr>
154 </table> 154 </table>
155 <a NAME="SourceStat.__init__" ID="SourceStat.__init__"></a> 155 <a NAME="SourceStat.__init__" ID="SourceStat.__init__"></a>
156 <h4>SourceStat (Constructor)</h4> 156 <h4>SourceStat (Constructor)</h4>
157 <b>SourceStat</b>(<i></i>) 157 <b>SourceStat</b>(<i></i>)
158 <p> 158 <p>
159 &#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114; 159 Constructor
160 </p><a NAME="SourceStat.dedent" ID="SourceStat.dedent"></a> 160 </p><a NAME="SourceStat.dedent" ID="SourceStat.dedent"></a>
161 <h4>SourceStat.dedent</h4> 161 <h4>SourceStat.dedent</h4>
162 <b>dedent</b>(<i>tok</i>) 162 <b>dedent</b>(<i>tok</i>)
163 <p> 163 <p>
164 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#100;&#101;&#99;&#114;&#101;&#109;&#101;&#110;&#116; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;. 164 Public method used to decrement the indentation level.
165 </p><dl> 165 </p><dl>
166 <dt><i>tok</i></dt> 166 <dt><i>tok</i></dt>
167 <dd> 167 <dd>
168 &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; &#116;&#111; &#98;&#101; &#112;&#114;&#111;&#99;&#101;&#115;&#115;&#101;&#100; (&#84;&#111;&#107;&#101;&#110;) 168 the token to be processed (Token)
169 </dd> 169 </dd>
170 </dl><a NAME="SourceStat.dump" ID="SourceStat.dump"></a> 170 </dl><a NAME="SourceStat.dump" ID="SourceStat.dump"></a>
171 <h4>SourceStat.dump</h4> 171 <h4>SourceStat.dump</h4>
172 <b>dump</b>(<i></i>) 172 <b>dump</b>(<i></i>)
173 <p> 173 <p>
174 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#102;&#111;&#114;&#109;&#97;&#116; &#97;&#110;&#100; &#112;&#114;&#105;&#110;&#116; &#116;&#104;&#101; &#99;&#111;&#108;&#108;&#101;&#99;&#116;&#101;&#100; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;. 174 Public method used to format and print the collected statistics.
175 </p><a NAME="SourceStat.getCounter" ID="SourceStat.getCounter"></a> 175 </p><a NAME="SourceStat.getCounter" ID="SourceStat.getCounter"></a>
176 <h4>SourceStat.getCounter</h4> 176 <h4>SourceStat.getCounter</h4>
177 <b>getCounter</b>(<i>id, key</i>) 177 <b>getCounter</b>(<i>id, key</i>)
178 <p> 178 <p>
179 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#103;&#101;&#116; &#97; &#115;&#112;&#101;&#99;&#105;&#102;&#105;&#99; &#99;&#111;&#117;&#110;&#116;&#101;&#114; v&#97;&#108;&#117;&#101;. 179 Public method used to get a specific counter value.
180 </p><dl> 180 </p><dl>
181 <dt><i>id</i></dt> 181 <dt><i>id</i></dt>
182 <dd> 182 <dd>
183 &#105;&#100; &#111;&#102; &#116;&#104;&#101; &#99;&#111;&#117;&#110;&#116;&#101;&#114; (&#115;&#116;&#114;&#105;&#110;&#103;) 183 id of the counter (string)
184 </dd><dt><i>key</i></dt> 184 </dd><dt><i>key</i></dt>
185 <dd> 185 <dd>
186 &#107;&#101;y &#111;&#102; &#116;&#104;&#101; v&#97;&#108;&#117;&#101; &#116;&#111; &#98;&#101; &#114;&#101;&#116;&#114;&#105;&#101;v&#101;&#100; (&#115;&#116;&#114;&#105;&#110;&#103;) 186 key of the value to be retrieved (string)
187 </dd> 187 </dd>
188 </dl><dl> 188 </dl><dl>
189 <dt>Returns:</dt> 189 <dt>Returns:</dt>
190 <dd> 190 <dd>
191 &#116;&#104;&#101; v&#97;&#108;&#117;&#101; &#111;&#102; &#116;&#104;&#101; &#114;&#101;&#113;&#117;&#101;&#115;&#116;&#101;&#100; &#99;&#111;&#117;&#110;&#116;&#101;&#114; (&#105;&#110;&#116;) 191 the value of the requested counter (int)
192 </dd> 192 </dd>
193 </dl><a NAME="SourceStat.inc" ID="SourceStat.inc"></a> 193 </dl><a NAME="SourceStat.inc" ID="SourceStat.inc"></a>
194 <h4>SourceStat.inc</h4> 194 <h4>SourceStat.inc</h4>
195 <b>inc</b>(<i>key, value=1</i>) 195 <b>inc</b>(<i>key, value=1</i>)
196 <p> 196 <p>
197 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#105;&#110;&#99;&#114;&#101;&#109;&#101;&#110;&#116; &#116;&#104;&#101; v&#97;&#108;&#117;&#101; &#111;&#102; &#97; &#107;&#101;y. 197 Public method used to increment the value of a key.
198 </p><dl> 198 </p><dl>
199 <dt><i>key</i></dt> 199 <dt><i>key</i></dt>
200 <dd> 200 <dd>
201 &#116;&#104;&#101; &#107;&#101;y &#116;&#111; &#98;&#101; &#105;&#110;&#99;&#114;&#101;&#109;&#101;&#110;&#116;&#101;&#100; 201 the key to be incremented
202 </dd><dt><i>value</i></dt> 202 </dd><dt><i>value</i></dt>
203 <dd> 203 <dd>
204 &#116;&#104;&#101; &#105;&#110;&#99;&#114;&#101;&#109;&#101;&#110;&#116; (&#105;&#110;&#116;) 204 the increment (int)
205 </dd> 205 </dd>
206 </dl><a NAME="SourceStat.indent" ID="SourceStat.indent"></a> 206 </dl><a NAME="SourceStat.indent" ID="SourceStat.indent"></a>
207 <h4>SourceStat.indent</h4> 207 <h4>SourceStat.indent</h4>
208 <b>indent</b>(<i>tok</i>) 208 <b>indent</b>(<i>tok</i>)
209 <p> 209 <p>
210 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#105;&#110;&#99;&#114;&#101;&#109;&#101;&#110;&#116; &#116;&#104;&#101; &#105;&#110;&#100;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110; &#108;&#101;v&#101;&#108;. 210 Public method used to increment the indentation level.
211 </p><dl> 211 </p><dl>
212 <dt><i>tok</i></dt> 212 <dt><i>tok</i></dt>
213 <dd> 213 <dd>
214 &#97; &#116;&#111;&#107;&#101;&#110; (&#84;&#111;&#107;&#101;&#110;, &#105;&#103;&#110;&#111;&#114;&#101;&#100;) 214 a token (Token, ignored)
215 </dd> 215 </dd>
216 </dl><a NAME="SourceStat.push" ID="SourceStat.push"></a> 216 </dl><a NAME="SourceStat.push" ID="SourceStat.push"></a>
217 <h4>SourceStat.push</h4> 217 <h4>SourceStat.push</h4>
218 <b>push</b>(<i>identifier, row</i>) 218 <b>push</b>(<i>identifier, row</i>)
219 <p> 219 <p>
220 &#80;&#117;&#98;&#108;&#105;&#99; &#109;&#101;&#116;&#104;&#111;&#100; &#117;&#115;&#101;&#100; &#116;&#111; &#115;&#116;&#111;&#114;&#101; &#97;&#110; &#105;&#100;&#101;&#110;&#116;&#105;&#102;&#105;&#101;&#114;. 220 Public method used to store an identifier.
221 </p><dl> 221 </p><dl>
222 <dt><i>identifier</i></dt> 222 <dt><i>identifier</i></dt>
223 <dd> 223 <dd>
224 &#116;&#104;&#101; &#105;&#100;&#101;&#110;&#116;&#105;&#102;&#105;&#101;&#114; &#116;&#111; &#98;&#101; &#114;&#101;&#109;&#101;&#109;&#98;&#101;&#114;&#101;&#100; (&#115;&#116;&#114;&#105;&#110;&#103;) 224 the identifier to be remembered (string)
225 </dd><dt><i>row</i></dt> 225 </dd><dt><i>row</i></dt>
226 <dd> 226 <dd>
227 &#116;&#104;&#101; &#114;&#111;w, &#116;&#104;&#101; &#105;&#100;&#101;&#110;&#116;&#105;&#102;&#105;&#101;&#114; &#105;&#115; &#100;&#101;&#102;&#105;&#110;&#101;&#100; &#105;&#110; (&#105;&#110;&#116;) 227 the row, the identifier is defined in (int)
228 </dd> 228 </dd>
229 </dl> 229 </dl>
230 <div align="right"><a href="#top">Up</a></div> 230 <div align="right"><a href="#top">Up</a></div>
231 <hr /><hr /> 231 <hr /><hr />
232 <a NAME="Token" ID="Token"></a> 232 <a NAME="Token" ID="Token"></a>
233 <h2>Token</h2> 233 <h2>Token</h2>
234 <p> 234 <p>
235 &#67;&#108;&#97;&#115;&#115; &#116;&#111; &#115;&#116;&#111;&#114;&#101; &#116;&#104;&#101; &#116;&#111;&#107;&#101;&#110; &#114;&#101;&#108;&#97;&#116;&#101;&#100; &#105;&#110;&#102;&#111;&#115;. 235 Class to store the token related infos.
236 </p> 236 </p>
237 <h3>Derived from</h3> 237 <h3>Derived from</h3>
238 object 238 object
239 <h3>Class Attributes</h3> 239 <h3>Class Attributes</h3>
240 <table> 240 <table>
242 </table> 242 </table>
243 <h3>Methods</h3> 243 <h3>Methods</h3>
244 <table> 244 <table>
245 <tr> 245 <tr>
246 <td><a href="#Token.__init__">Token</a></td> 246 <td><a href="#Token.__init__">Token</a></td>
247 <td>&#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114;</td> 247 <td>Constructor</td>
248 </tr> 248 </tr>
249 </table> 249 </table>
250 <a NAME="Token.__init__" ID="Token.__init__"></a> 250 <a NAME="Token.__init__" ID="Token.__init__"></a>
251 <h4>Token (Constructor)</h4> 251 <h4>Token (Constructor)</h4>
252 <b>Token</b>(<i>**kw</i>) 252 <b>Token</b>(<i>**kw</i>)
253 <p> 253 <p>
254 &#67;&#111;&#110;&#115;&#116;&#114;&#117;&#99;&#116;&#111;&#114; 254 Constructor
255 </p><dl> 255 </p><dl>
256 <dt><i>**kw</i></dt> 256 <dt><i>**kw</i></dt>
257 <dd> 257 <dd>
258 &#108;&#105;&#115;&#116; &#111;&#102; &#107;&#101;y, v&#97;&#108;&#117;&#101; &#112;&#97;&#105;&#114;&#115; 258 list of key, value pairs
259 </dd> 259 </dd>
260 </dl> 260 </dl>
261 <div align="right"><a href="#top">Up</a></div> 261 <div align="right"><a href="#top">Up</a></div>
262 <hr /><hr /> 262 <hr /><hr />
263 <a NAME="analyze" ID="analyze"></a> 263 <a NAME="analyze" ID="analyze"></a>
264 <h2>analyze</h2> 264 <h2>analyze</h2>
265 <b>analyze</b>(<i>filename, total</i>) 265 <b>analyze</b>(<i>filename, total</i>)
266 <p> 266 <p>
267 267
268 </p><p> 268 </p><p>
269 &#77;&#111;&#100;&#117;&#108;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#117;&#115;&#101;&#100; &#97;&#110;&#97;&#108;yz&#101; &#116;&#104;&#101; &#115;&#111;&#117;&#114;&#99;&#101; &#111;&#102; &#97; &#80;y&#116;&#104;&#111;&#110; &#102;&#105;&#108;&#101;. 269 Module function used analyze the source of a Python file.
270 </p><dl> 270 </p><dl>
271 <dt><i>filename</i></dt> 271 <dt><i>filename</i></dt>
272 <dd> 272 <dd>
273 &#110;&#97;&#109;&#101; &#111;&#102; &#116;&#104;&#101; &#80;y&#116;&#104;&#111;&#110; &#102;&#105;&#108;&#101; &#116;&#111; &#98;&#101; &#97;&#110;&#97;&#108;yz&#101;&#100; (&#115;&#116;&#114;&#105;&#110;&#103;) 273 name of the Python file to be analyzed (string)
274 </dd><dt><i>total</i></dt> 274 </dd><dt><i>total</i></dt>
275 <dd> 275 <dd>
276 &#100;&#105;&#99;&#116;&#105;&#111;&#110;&#97;&#114;y &#114;&#101;&#99;&#101;&#105;v&#105;&#110;&#103; &#116;&#104;&#101; &#111;v&#101;&#114;&#97;&#108;&#108; &#99;&#111;&#100;&#101; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115; 276 dictionary receiving the overall code statistics
277 </dd> 277 </dd>
278 </dl><dl> 278 </dl><dl>
279 <dt>Returns:</dt> 279 <dt>Returns:</dt>
280 <dd> 280 <dd>
281 &#97; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115; &#111;&#98;&#106;&#101;&#99;&#116; w&#105;&#116;&#104; &#116;&#104;&#101; &#99;&#111;&#108;&#108;&#101;&#99;&#116;&#101;&#100; &#99;&#111;&#100;&#101; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115; (&#83;&#111;&#117;&#114;&#99;&#101;&#83;&#116;&#97;&#116;) 281 a statistics object with the collected code statistics (SourceStat)
282 </dd> 282 </dd>
283 </dl> 283 </dl>
284 <div align="right"><a href="#top">Up</a></div> 284 <div align="right"><a href="#top">Up</a></div>
285 <hr /><hr /> 285 <hr /><hr />
286 <a NAME="main" ID="main"></a> 286 <a NAME="main" ID="main"></a>
287 <h2>main</h2> 287 <h2>main</h2>
288 <b>main</b>(<i></i>) 288 <b>main</b>(<i></i>)
289 <p> 289 <p>
290 &#77;&#111;&#100;&#117;&#108;&#101;&#115; &#109;&#97;&#105;&#110; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#117;&#115;&#101;&#100; w&#104;&#101;&#110; &#99;&#97;&#108;&#108;&#101;&#100; &#97;&#115; &#97; &#115;&#99;&#114;&#105;&#112;&#116;. 290 Modules main function used when called as a script.
291 </p><p> 291 </p><p>
292 &#84;&#104;&#105;&#115; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#115;&#105;&#109;&#112;&#108;y &#108;&#111;&#111;&#112;&#115; &#111;v&#101;&#114; &#97;&#108;&#108; &#102;&#105;&#108;&#101;&#115; &#103;&#105;v&#101;&#110; &#111;&#110; &#116;&#104;&#101; &#99;&#111;&#109;&#109;&#97;&#110;&#100;&#108;&#105;&#110;&#101; 292 This function simply loops over all files given on the commandline
293 &#97;&#110;&#100; &#99;&#111;&#108;&#108;&#101;&#99;&#116;&#115; &#116;&#104;&#101; &#105;&#110;&#100;&#105;v&#105;&#100;&#117;&#97;&#108; &#97;&#110;&#100; &#111;v&#101;&#114;&#97;&#108;&#108; &#115;&#111;&#117;&#114;&#99;&#101; &#99;&#111;&#100;&#101; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;. 293 and collects the individual and overall source code statistics.
294 </p> 294 </p>
295 <div align="right"><a href="#top">Up</a></div> 295 <div align="right"><a href="#top">Up</a></div>
296 <hr /><hr /> 296 <hr /><hr />
297 <a NAME="summarize" ID="summarize"></a> 297 <a NAME="summarize" ID="summarize"></a>
298 <h2>summarize</h2> 298 <h2>summarize</h2>
299 <b>summarize</b>(<i>total, key, value</i>) 299 <b>summarize</b>(<i>total, key, value</i>)
300 <p> 300 <p>
301 &#77;&#111;&#100;&#117;&#108;&#101; &#102;&#117;&#110;&#99;&#116;&#105;&#111;&#110; &#117;&#115;&#101;&#100; &#116;&#111; &#99;&#111;&#108;&#108;&#101;&#99;&#116; &#111;v&#101;&#114;&#97;&#108;&#108; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115;. 301 Module function used to collect overall statistics.
302 </p><dl> 302 </p><dl>
303 <dt><i>total</i></dt> 303 <dt><i>total</i></dt>
304 <dd> 304 <dd>
305 &#116;&#104;&#101; &#100;&#105;&#99;&#116;&#105;&#111;&#110;&#97;&#114;y &#102;&#111;&#114; &#116;&#104;&#101; &#111;v&#101;&#114;&#97;&#108;&#108; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115; 305 the dictionary for the overall statistics
306 </dd><dt><i>key</i></dt> 306 </dd><dt><i>key</i></dt>
307 <dd> 307 <dd>
308 &#116;&#104;&#101; &#107;&#101;y &#116;&#111; &#98;&#101; &#115;&#117;&#109;&#109;&#97;&#114;&#105;z&#101; 308 the key to be summarize
309 </dd><dt><i>value</i></dt> 309 </dd><dt><i>value</i></dt>
310 <dd> 310 <dd>
311 &#116;&#104;&#101; v&#97;&#108;&#117;&#101; &#116;&#111; &#98;&#101; &#97;&#100;&#100;&#101;&#100; &#116;&#111; &#116;&#104;&#101; &#111;v&#101;&#114;&#97;&#108;&#108; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115; 311 the value to be added to the overall statistics
312 </dd> 312 </dd>
313 </dl><dl> 313 </dl><dl>
314 <dt>Returns:</dt> 314 <dt>Returns:</dt>
315 <dd> 315 <dd>
316 &#116;&#104;&#101; v&#97;&#108;&#117;&#101; &#97;&#100;&#100;&#101;&#100; &#116;&#111; &#116;&#104;&#101; &#111;v&#101;&#114;&#97;&#108;&#108; &#115;&#116;&#97;&#116;&#105;&#115;&#116;&#105;&#99;&#115; 316 the value added to the overall statistics
317 </dd> 317 </dd>
318 </dl> 318 </dl>
319 <div align="right"><a href="#top">Up</a></div> 319 <div align="right"><a href="#top">Up</a></div>
320 <hr /> 320 <hr />
321 </body></html> 321 </body></html>

eric ide

mercurial