Module implementing a simple Python code metrics analyzer.
Imported modules
|
|
import cStringIO
import keyword
import os
import token
import tokenize
|
Functions
|
|
analyze
main
summarize
|
|
analyze
|
analyze ( filename, total )
Module function used analyze the source of a Python file.
Arguments
- filename
- name of the Python file to be analyzed (string)
- total
- dictionary receiving the overall code statistics
Returns
a statistics object with the collected code statistics (SourceStat)
|
|
main
|
main ()
Modules main function used when called as a script.
This function simply loops over all files given on the commandline
and collects the individual and overall source code statistics.
|
|
summarize
|
summarize (
total,
key,
value,
)
Module function used to collect overall statistics.
Arguments
- total
- the dictionary for the overall statistics
- key
- the key to be summarize
- value
- the value to be added to the overall statistics
Returns
the value added to the overall statistics
|
Classes
|
|
Parser |
Class used to parse the source code of a Python file.
|
SourceStat |
Class used to calculate and store the source code statistics.
|
Token |
Class to store the token related infos.
|
|