<commit_before>import logging
import multiprocessing

from .exchange_mailbox_scanner import ExportError, ExchangeMailboxScanner


class ExchangeServerScanner(multiprocessing.Process):
    """ Helper class to allow parallel processing of export
    This classes inherits from multiprocessing and helps to
    run a number of exporters in parallel """
    def __init__(self, user_queue, domain, exchange_scanner, start_date=None):
        multiprocessing.Process.__init__(self)
        logger = logging.Logger('Exchange_server_scan')
        logfile_path = exchange_scanner.scan_object.scan_log_file()
        fh = logging.FileHandler(logfile_path)
        fh.setLevel(logging.INFO)
        logger.addHandler(fh)
        self.logger = logger
        self.user_queue = user_queue
        self.scanner = None
        self.user_name = None
        self.start_date = start_date
        self.domain = domain
        self.exchange_scanner = exchange_scanner

    def run(self):
        while not self.user_queue.empty():
            try:
                self.user_name = self.user_queue.get()
                self.logger.info('Scanning {}'.format(self.user_name))

                self.scanner = ExchangeMailboxScanner(self.user_name,
                                                      self.domain,
                                                      self.exchange_scanner)

                total_count = self.scanner.total_mails()
                self.scanner.check_mailbox(total_count)
                self.logger.info('Done with {}'.format(self.user_name))
            except MemoryError:
                msg = 'We had a memory-error from {}'
                self.logger.error(msg.format(self.user_name))
                self.user_queue.put(self.user_name)
            except ExportError:
                msg = 'Could not export all of {}'
                self.logger.error(msg.format(self.user_name))
                self.user_queue.put(self.user_name)<commit_msg>* scan_log_file is a property, not a method.<commit_after>import logging
import multiprocessing

from .exchange_mailbox_scanner import ExportError, ExchangeMailboxScanner


class ExchangeServerScanner(multiprocessing.Process):
    """ Helper class to allow parallel processing of export
    This classes inherits from multiprocessing and helps to
    run a number of exporters in parallel """
    def __init__(self, user_queue, domain, exchange_scanner, start_date=None):
        multiprocessing.Process.__init__(self)
        logger = logging.Logger('Exchange_server_scan')
        logfile_path = exchange_scanner.scan_object.scan_log_file
        fh = logging.FileHandler(logfile_path)
        fh.setLevel(logging.INFO)
        logger.addHandler(fh)
        self.logger = logger
        self.user_queue = user_queue
        self.scanner = None
        self.user_name = None
        self.start_date = start_date
        self.domain = domain
        self.exchange_scanner = exchange_scanner

    def run(self):
        while not self.user_queue.empty():
            try:
                self.user_name = self.user_queue.get()
                self.logger.info('Scanning {}'.format(self.user_name))

                self.scanner = ExchangeMailboxScanner(self.user_name,
                                                      self.domain,
                                                      self.exchange_scanner)

                total_count = self.scanner.total_mails()
                self.scanner.check_mailbox(total_count)
                self.logger.info('Done with {}'.format(self.user_name))
            except MemoryError:
                msg = 'We had a memory-error from {}'
                self.logger.error(msg.format(self.user_name))
                self.user_queue.put(self.user_name)
            except ExportError:
                msg = 'Could not export all of {}'
                self.logger.error(msg.format(self.user_name))
                self.user_queue.put(self.user_name)
{'fraction_non_alphanumeric': 0.08057590300580955, 'fraction_numerical': 0.0, 'mean_word_length': 2.0298393267023718, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4154063', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1030, 'n_words': 212}