<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:softtabstop=4:shiftwidth=4

import os
import sys
import subprocess
import shutil

import logging
import logging.handlers

import Queue
import ConfigParser

from resource import getrlimit, RLIMIT_NOFILE

from contextlib import contextmanager
import tempfile
import stat

import daemon
import lockfile
try:
    from lockfile import pidlockfile
except ImportError:
    from daemon import pidlockfile

import yaml

from .gitlab import WatchGitlab
from .gerrit import WatchGerrit

ONEYEAR = 365*24*60*60
GIT_SSH_WRAPPER = '''#!/bin/sh

if [ -z "$PKEY" ]; then
    # if PKEY is not specified, run ssh using default keyfile
    ssh "$@"
else
    ssh -i "$PKEY" "$@"
fi
'''


@contextmanager
def FakeContext():
    '''
     This allows us to call with context: but not provide a DaemonContext
    '''
    yield


def get_class(classname):
    '''
    Gets a class that is in the global scope by looking up the name
    '''
    return globals()[classname]


class RepoWatch(object):<commit_msg>Adding support for #19 after huge rewrite<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:softtabstop=4:shiftwidth=4

import os
import sys
import subprocess
import shutil

import logging
import logging.handlers

import Queue
import ConfigParser

from resource import getrlimit, RLIMIT_NOFILE

from contextlib import contextmanager
import tempfile
import stat

import daemon
import lockfile
try:
    from lockfile import pidlockfile
except ImportError:
    from daemon import pidlockfile

import yaml

from .gitlab import WatchGitlab
from .gerrit import WatchGerrit

ONEYEAR = 365*24*60*60
GIT_SSH_WRAPPER = '''#!/bin/sh

if [ -z "$PKEY" ]; then
    # if PKEY is not specified, run ssh using default keyfile
    ssh "$@"
else
    ssh -oStrictHostKeyChecking=no -i "$PKEY" "$@"
fi
'''


@contextmanager
def FakeContext():
    '''
     This allows us to call with context: but not provide a DaemonContext
    '''
    yield


def get_class(classname):
    '''
    Gets a class that is in the global scope by looking up the name
    '''
    return globals()[classname]


class RepoWatch(object):
{'fraction_non_alphanumeric': 0.08721735117674204, 'fraction_numerical': 0.012921089063221043, 'mean_word_length': 3.8719101123595507, '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': '3703720', 'n_tokens_mistral': 723, 'n_tokens_neox': 683, 'n_words': 244}