<commit_before>import os
import time
from datetime import datetime

"""The purpose of the script is to generate a report of when was the time a DPR was updated."""

fileList = []
timeList = []
employeeCount = 0

path = r"Z:\DPR\2017"  # Path to the DPR folder
dirs = os.listdir(path)
for folder in dirs:  # For every DPR in the folder extract last modified time
    folderpath = path + "\\" + str(folder)
    if os.path.isdir(folderpath):
        employeeCount += 1
        files = os.listdir(folderpath)
        for file in files:
            if str(file)[0] != "~" and "DPR_2017" in str(file):
                fileList.append(file)
                filepath = folderpath + "\\" + str(file)
                catchTime = time.ctime(os.stat(filepath).st_mtime)
                catchTime = catchTime.replace(" ", ",")
                timeList.append(catchTime)

result = dict(zip(fileList, timeList))
keyList = result.keys()
keyList.sort()

# Error Report
if employeeCount == len(keyList):
    endLine = "All employees are accounted for"
else:
    endLine = "Someone has more than one copy of DPRs"

# Path of Report file to be created
csvPath = r"Z:\DPR\2017\DPR Update Status.csv"
f = open(csvPath, "w")

# Header for the file
updateTime = str(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
f.write("This is an auto generated DPR update report. It shows when was a DPR last updated." + "\n")
f.write("This report was last generated on " + updateTime + "\n")
f.write(endLine + "\n")
f.write("Developed By : MSA R & D" + "\n")
f.write("\n")

# DPR report
for key in keyList:
    line = key + "," + result[key]
    f.write(line + "\n")

f.close()
print("File written successfully! Yeah!")<commit_msg>DPR Update<commit_after>import os
import time
from datetime import datetime

"""The purpose of the script is to generate a report of when was the time a DPR was updated."""

fileList = []
timeList = []
employeeCount = 0

path = r"Z:\DPR\2017"  # Path to the DPR folder
dirs = os.listdir(path)
for folder in dirs:  # For every DPR in the folder extract last modified time
    folderpath = path + "\\" + str(folder)
    if os.path.isdir(folderpath):
        employeeCount += 1
        files = os.listdir(folderpath)
        for file in files:
            if str(file)[0] != "~" and "DPR_2017" in str(file):
                fileList.append(file)
                filepath = folderpath + "\\" + str(file)
                catchTime = time.ctime(os.stat(filepath).st_mtime)
                catchTime = catchTime.replace(" ", ",")
                timeList.append(catchTime)

result = dict(zip(fileList, timeList))
keyList = result.keys()
keyList.sort()

# Error Report
if employeeCount == len(keyList):
    endLine = "All employees are accounted for"
else:
    endLine = "Someone has more than one copy of DPRs"

# Path of Report file to be created
csvPath = r"C:\Users\dchauhan\Desktop\DPR Update Status.csv"
f = open(csvPath, "w")

# Header for the file
updateTime = str(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
f.write("This is an auto generated DPR update report. It shows when was a DPR last updated." + "\n")
f.write("This report was last generated on " + updateTime + "\n")
f.write(endLine + "\n")
f.write("Developed By : MSA R & D" + "\n")
f.write("\n")

# DPR report
for key in keyList:
    line = key + "," + result[key]
    f.write(line + "\n")

f.close()
print("File written successfully! Yeah!")
{'fraction_non_alphanumeric': 0.13680494263018536, 'fraction_numerical': 0.007649308620182407, 'mean_word_length': 3.014167650531287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5126025', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1087, 'n_words': 360}