<commit_before>#!  /usr/bin/env python
#
# Clean python factory logs
#
# $Id: cleanLogs.py 154 2010-03-19 13:02:16Z graemes $
#

import datetime
import logging
import os
import random
import re
import shutil
import threading
import time

from autopyfactory.interfaces import _thread

class CleanLogs(_thread):
    '''
    -----------------------------------------------------------------------
    Class to handle the log files removal.
    There are several possibilities to decide which files 
    have to be deleted is:
        - basic algorithm is just to remove files older than some 
          number of days.
        - based on disk space usage. 
          We can keep files as long as possible, until some percentage
          of the disk is used. 
        - Both algorithm can be combined. 
    -----------------------------------------------------------------------
    Public Interface:
        the interface inherited from Thread `
    -----------------------------------------------------------------------
    '''
    def __init__(self, factory):
        '''
        factory is a reference to the Factory object that created
        the CleanLogs instance
        '''

        _thread.__init__(self)
        self._thread_loop_interval = 24 * 60 * 60  # sleep 24 hours between loops

        factory.threadsregistry.add("util", self)

        self.log = logging.getLogger('main.cleanlogs')
        self.log.trace('CleanLogs: Initializing object...')
    
        self.factory = factory<commit_msg>sleep 1 hour instead of 24<commit_after>#!  /usr/bin/env python
#
# Clean python factory logs
#
# $Id: cleanLogs.py 154 2010-03-19 13:02:16Z graemes $
#

import datetime
import logging
import os
import random
import re
import shutil
import threading
import time

from autopyfactory.interfaces import _thread

class CleanLogs(_thread):
    '''
    -----------------------------------------------------------------------
    Class to handle the log files removal.
    There are several possibilities to decide which files 
    have to be deleted is:
        - basic algorithm is just to remove files older than some 
          number of days.
        - based on disk space usage. 
          We can keep files as long as possible, until some percentage
          of the disk is used. 
        - Both algorithm can be combined. 
    -----------------------------------------------------------------------
    Public Interface:
        the interface inherited from Thread `
    -----------------------------------------------------------------------
    '''
    def __init__(self, factory):
        '''
        factory is a reference to the Factory object that created
        the CleanLogs instance
        '''

        _thread.__init__(self)
        self._thread_loop_interval = 60 * 60  # sleep 1 hour between loops

        factory.threadsregistry.add("util", self)

        self.log = logging.getLogger('main.cleanlogs')
        self.log.trace('CleanLogs: Initializing object...')
    
        self.factory = factory
{'fraction_non_alphanumeric': 0.19861202908129544, 'fraction_numerical': 0.016523463317911435, 'mean_word_length': 1.5183028286189684, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4792303', 'n_tokens_mistral': 744, 'n_tokens_neox': 683, 'n_words': 275}