lib_code_stats module¶
CorrelX line counter tools.
Usage¶
get_cx_code_stats()
-
lib_code_stats.
get_cx_code_stats
(filelist_v=[['Launcher and Filesystem Management', 'mapred_cx.py,lib_mapredcorr.py,lib_profiling.py,lib_net_stats.py,lib_ini_exper.py,lib_hadoop_hdfs.py,lib_config.py,const_config.py,const_hadoop.py'], ['Application', 'msvf.py,rsvf.py'], ['Libraries', 'const_mapred.py,const_quant.py,lib_quant.py,lib_vdif.py,const_ini_files.py,lib_ini_files.py,lib_acc_comp.py,lib_delay_model.py,lib_fx_stack.py,lib_pcal.py,const_debug.py,const_performance.py,lib_debug.py'], ['Tools', 'lib_code_stats.py,vdif_info.py,vdif_generator.py,vis_compare.py,cx2d_lib.py,convert_im_cx.py,process_zoom.py,convert_cx2d.py']], p='./', output_file='stats_code', debug_doc_file='stats_code_debug')[source]¶ Generate statistics for CorrelX source code.
- filelist_v
- list of lists following the format [“group identifier”, “lib1.py,lib2.py,...,libN.py”]
- p : str
- path to source file.
- output_file : str
- prefix for output file.
None
-
lib_code_stats.
get_file_stats
(full_input_file, full_debug_file, debug_doc=0)[source]¶ Get statistics for a single file.
- full_input_file : str
- path to file to process (.py).
- full_debug_file : str
- path to file to debug doc section.
- debug_doc : int
- 1 to debug.
- c_line : int
- number of lines (total).
- c_code : int
- number of lines with code.
- c_comment : int
- number of comment-only lines.
- c_empty : int
- number of blank lines.
- c_ne : int
- number of non-blank lines.
Assumptions:It is assumed that the three quotations marks are only used to delimitNotes:All non-empty lines in the doc section of the functions is accounted as comments.Lines of code containing both code and comment are counted as code only
-
lib_code_stats.
get_out_line_stats
(str_v)[source]¶ Generate output line with statistics.
- str_v : list of str
- [“str_identifier”, str1, str2, ...] or [“str_identifier”, int1, int2, ...]
- str
- tabulated output line.
lines_out.append(” “+”[File]”.ljust(20)+str(“[Total]”).rjust(WIDTH_NUM)+ str(“[Code]”).rjust(WIDTH_NUM)+ str(“[Comments]”).rjust(WIDTH_NUM)+ str(“[Empty]”).rjust(WIDTH_NUM)+ str(“[Non-empty]”).rjust(WIDTH_NUM))