<commit_before>#!/usr/bin/python
import os
from time import gmtime, strftime
import logging

__author__ = '<NAME>'
__location__ = os.path.dirname(os.path.abspath(__file__))
script_run_time = strftime("%Y-%m-%d_%H-%M-%S", gmtime())
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.FileHandler(os.path.join(__location__, 'log_cleaner.out'))
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.info('')
logger.info('************************ Script Calismaya Basladi... ******************************')

try:
    qf = open(os.path.join(__location__, 'log_cleaner_properties'), 'r')
    for line in qf:
        try:
            line = ''.join(line.split())
            if line == '' or line[0] == '#':
                continue
            lc_props = line.split('|||')
            if lc_props[3] == 'delete':
                lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli ' + \
                    lc_props[2] + ' gundur degismemis dosyalar siliniyor!'
                logger.info(lc_message)
                lc_command = 'find ' + lc_props[0] + ' -name ' + lc_props[1] + ' -mtime +' + lc_props[2]
                lc_message = os.popen(lc_command).read()
                logger.info(lc_message)
                lc_command = 'rm -f ' + '$(find ' + lc_props[0] + ' -name ' + lc_props[1] + \
                    ' -mtime +' + lc_props[2] + ')'
                os.system(lc_command)
            if lc_props[3] == 'zip':
                lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli ' + \
                    lc_props[2] + ' gundur degismemis dosyalar zipleniyor!'
                logger.info(lc_message)
                lc_command = 'find ' + lc_props[0] + ' -name ' + lc_props[1] + ' -mtime +' + lc_props[2]
                log_files = os.popen(lc_command).read()
                logger.info(log_files)
                if log_files == '':
                    lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli dosya bulunamadi!'
                    logger.info(lc_message)
                    continue
                if os.path.isfile(os.path.join(__location__, 'temp_file')):
                    os.remove(os.path.join(__location__, 'temp_file'))
                temp_file = open(os.path.join(__location__, 'temp_file'), 'w')
                temp_file.write(log_files)
                temp_file.close()
                tar_file = os.path.join(os.path.dirname(lc_props[4]),
                    script_run_time + '_' + os.path.basename(lc_props[4]))
                lc_command = 'tar -czvf ' + tar_file + ' -T ' + os.path.join(__location__, 'temp_file')
                os.system(lc_command)
                if os.path.isfile(os.path.join(__location__, 'temp_file')):
                    os.remove(os.path.join(__location__, 'temp_file'))
                lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli ' + \
                    lc_props[2] + ' gundur degismemis dosyalar siliniyor!'
                logger.info(lc_message)
                lc_command = 'find ' + lc_props[0] + ' -name ' + lc_props[1] + ' -mtime +' + lc_props[2]
                lc_message = os.popen(lc_command).read()
                logger.info(lc_message)
                lc_command = 'rm -f ' + '$(find ' + lc_props[0] + ' -name ' + lc_props[1] + \
                    ' -mtime +' + lc_props[2] + ')'
                os.system(lc_command)
        except Exception, e:
            logger.error(e)
finally:
    qf.close()<commit_msg>line indentation<commit_after>#!/usr/bin/python
import os
from time import gmtime, strftime
import logging

__author__ = '<NAME>'
__location__ = os.path.dirname(os.path.abspath(__file__))
script_run_time = strftime("%Y-%m-%d_%H-%M-%S", gmtime())
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.FileHandler(os.path.join(__location__, 'log_cleaner.out'))
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.info('')
logger.info('************************ Script Calismaya Basladi... ******************************')

try:
    qf = open(os.path.join(__location__, 'log_cleaner_properties'), 'r')
    for line in qf:
        try:
            line = ''.join(line.split())
            if line == '' or line[0] == '#':
                continue
            lc_props = line.split('|||')
            if lc_props[3] == 'delete':
                lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli ' + \
                    lc_props[2] + ' gundur degismemis dosyalar siliniyor!'
                logger.info(lc_message)
                lc_command = 'find ' + lc_props[0] + ' -name ' + lc_props[1] + ' -mtime +' + lc_props[2]
                lc_message = os.popen(lc_command).read()
                logger.info(lc_message)
                lc_command = 'rm -f ' + '$(find ' + lc_props[0] + ' -name ' + lc_props[1] + \
                    ' -mtime +' + lc_props[2] + ')'
                os.system(lc_command)
            if lc_props[3] == 'zip':
                lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli ' + \
                    lc_props[2] + ' gundur degismemis dosyalar zipleniyor!'
                logger.info(lc_message)
                lc_command = 'find ' + lc_props[0] + ' -name ' + lc_props[1] + ' -mtime +' + lc_props[2]
                log_files = os.popen(lc_command).read()
                logger.info(log_files)
                if log_files == '':
                    lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli dosya bulunamadi!'
                    logger.info(lc_message)
                    continue
                if os.path.isfile(os.path.join(__location__, 'temp_file')):
                    os.remove(os.path.join(__location__, 'temp_file'))
                temp_file = open(os.path.join(__location__, 'temp_file'), 'w')
                temp_file.write(log_files)
                temp_file.close()
                tar_file = os.path.join(os.path.dirname(lc_props[4]),
                                        script_run_time + '_' + os.path.basename(lc_props[4]))
                lc_command = 'tar -czvf ' + tar_file + ' -T ' + os.path.join(__location__, 'temp_file')
                os.system(lc_command)
                if os.path.isfile(os.path.join(__location__, 'temp_file')):
                    os.remove(os.path.join(__location__, 'temp_file'))
                lc_message = lc_props[0] + ' - ' + lc_props[1] + ' patternli ' + \
                    lc_props[2] + ' gundur degismemis dosyalar siliniyor!'
                logger.info(lc_message)
                lc_command = 'find ' + lc_props[0] + ' -name ' + lc_props[1] + ' -mtime +' + lc_props[2]
                lc_message = os.popen(lc_command).read()
                logger.info(lc_message)
                lc_command = 'rm -f ' + '$(find ' + lc_props[0] + ' -name ' + lc_props[1] + \
                    ' -mtime +' + lc_props[2] + ')'
                os.system(lc_command)
        except Exception, e:
            logger.error(e)
finally:
    qf.close()
{'fraction_non_alphanumeric': 0.16221453287197232, 'fraction_numerical': 0.008581314878892734, 'mean_word_length': 1.9397884458909682, 'pattern_counts': {'":': 0, '<': 5, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3460737', 'n_tokens_mistral': 2495, 'n_tokens_neox': 2357, 'n_words': 368}