<commit_before>#! /usr/bin/python

import os
import sys

searchExts = ['.c', '.cpp', '.h', '.hpp']

def getLOC(arg, dirname, names):
    for fname in names:
        pathToFile = os.path.join(dirname, fname)   
        if os.path.splitext(pathToFile)[1] in searchExts:
            print 'File:\t',fname,'\tLOC:\t',sum (1 for l in open(pathToFile, "r")),'\tFolder:\t',os.path.dirname(pathToFile)
#MAIN
if __name__ == '__main__':
    wrkDir = os.getcwd()
    if len(sys.argv) > 1:
        if os.path.exists(sys.argv[1]) and os.path.isdir(sys.argv[1]):
            wrkDir = sys.argv[1] 
    os.path.walk( wrkDir, getLOC, None)

                            
                  
        <commit_msg>calculate total code size<commit_after>#! /usr/bin/python

import os
import sys

searchExts = ['.c', '.cpp', '.h', '.hpp']
total = 0

def getLOC(arg, dirname, names):
    for fname in names:
        pathToFile = os.path.join(dirname, fname)   
        if os.path.splitext(pathToFile)[1] in searchExts:
            global total
            local = sum (1 for l in open(pathToFile, "r"))
            total = total + local
            print 'File:\t',fname,'\tLOC:\t',local,'\tFolder:\t',os.path.dirname(pathToFile)
#MAIN
if __name__ == '__main__':
    wrkDir = os.getcwd()
    if len(sys.argv) > 1:
        if os.path.exists(sys.argv[1]) and os.path.isdir(sys.argv[1]):
            wrkDir = sys.argv[1] 
    os.path.walk( wrkDir, getLOC, None)
    global total
    print 'Total:', total

                            
                  
        
{'fraction_non_alphanumeric': 0.15514993481095177, 'fraction_numerical': 0.00847457627118644, 'mean_word_length': 2.0823293172690764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7340610', 'n_tokens_mistral': 558, 'n_tokens_neox': 546, 'n_words': 123}