<commit_before>"""
dirsync

Report the difference in content
of two directories, synchronise or
update a directory from another, taking
into account time-stamps of files etc.

(c) <NAME> 2014

Based on Robocopy by <NAME>

"""

import os
import sys
import stat
import time
import shutil
import re
import logging

from .options import OPTIONS
from .version import __pkg_name__


class DCMP(object):
    """Dummy object for directory comparison data storage"""
    def __init__(self, l, r, c):
        self.left_only = l
        self.right_only = r
        self.common = c


class Syncer(object):
    """ An advanced directory synchronisation, update
    and file copying class """

    def __init__(self, dir1, dir2, action, **options):

        self.logger = options.get('logger', None)
        if not self.logger:
            # configure default logger to stdout
            log = logging.getLogger('dirsync')
            log.setLevel(logging.INFO)
            hdl = logging.StreamHandler(sys.stdout)
            hdl.setFormatter(logging.Formatter('%(message)s'))
            log.addHandler(hdl)
            self.logger = log

        self._dir1 = dir1
        self._dir2 = dir2

        self._copyfiles = True
        self._updatefiles = True
        self._creatdirs = True

        self._changed = []
        self._added = []
        self._deleted = []

        # stat vars
        self._numdirs = 0
        self._numfiles = 0
        self._numdelfiles = 0
        self._numdeldirs = 0
        self._numnewdirs = 0
        self._numupdates = 0
        self._starttime = 0.0
        self._endtime = 0.0<commit_msg>[fix #1] Fixes repeated logs issue<commit_after>"""
dirsync

Report the difference in content
of two directories, synchronise or
update a directory from another, taking
into account time-stamps of files etc.

(c) <NAME> 2014

Based on Robocopy by <NAME>

"""

import os
import sys
import stat
import time
import shutil
import re
import logging

from .options import OPTIONS
from .version import __pkg_name__


class DCMP(object):
    """Dummy object for directory comparison data storage"""
    def __init__(self, l, r, c):
        self.left_only = l
        self.right_only = r
        self.common = c


class Syncer(object):
    """ An advanced directory synchronisation, update
    and file copying class """

    def __init__(self, dir1, dir2, action, **options):

        self.logger = options.get('logger', None)
        if not self.logger:
            # configure default logger to stdout
            log = logging.getLogger('dirsync')
            log.setLevel(logging.INFO)
            if not log.handlers:
                hdl = logging.StreamHandler(sys.stdout)
                hdl.setFormatter(logging.Formatter('%(message)s'))
                log.addHandler(hdl)
            self.logger = log

        self._dir1 = dir1
        self._dir2 = dir2

        self._copyfiles = True
        self._updatefiles = True
        self._creatdirs = True

        self._changed = []
        self._added = []
        self._deleted = []

        # stat vars
        self._numdirs = 0
        self._numfiles = 0
        self._numdelfiles = 0
        self._numdeldirs = 0
        self._numnewdirs = 0
        self._numupdates = 0
        self._starttime = 0.0
        self._endtime = 0.0
{'fraction_non_alphanumeric': 0.08889563106796117, 'fraction_numerical': 0.012439320388349514, 'mean_word_length': 2.1580459770114944, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2800599', 'n_tokens_mistral': 992, 'n_tokens_neox': 939, 'n_words': 291}