<commit_before>#!/usr/bin/env python
# Copyright (C) 2015 <NAME>
# This file is part of my GSoC'15 project for Cuckoo Sandbox:
#	http://www.cuckoosandbox.org
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.

from os import path
from time import sleep

def sanitize_path(path):
    """ Replace spaces with backslashes+spaces """
    return path.replace(" ", "\\ ")

def path_for_script(script):
    """ Return the full path for the given script """
    return path.join(path.dirname(path.abspath(__file__)), script)


def filelines(file):
    """ A generator that returns lines of the file.
    If there're no new lines it waits until the file is updated.
    """
    # Go to the end of the file
    file.seek(0,2)
    while True:
        line = file.readline()
        if not line:
            # Sleep briefly
            sleep(0.1)
            continue
        yield line<commit_msg>dtrace's common.py: add current_directory() function<commit_after>#!/usr/bin/env python
# Copyright (C) 2015 <NAME>
# This file is part of my GSoC'15 project for Cuckoo Sandbox:
#	http://www.cuckoosandbox.org
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.

from os import path
from time import sleep

def sanitize_path(path):
    """ Replace spaces with backslashes+spaces """
    return path.replace(" ", "\\ ")

def path_for_script(script):
    """ Return the full path for the given script """
    return path.join(current_directory(), script)

def current_directory():
    return path.dirname(path.abspath(__file__))

def filelines(file):
    """ A generator that returns lines of the file.
    If there're no new lines it waits until the file is updated.
    """
    # Go to the end of the file
    file.seek(0,2)
    while True:
        line = file.readline()
        if not line:
            # Sleep briefly
            sleep(0.1)
            continue
        yield line
{'fraction_non_alphanumeric': 0.09675810473815462, 'fraction_numerical': 0.00997506234413965, 'mean_word_length': 2.887596899224806, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4106248', 'n_tokens_mistral': 601, 'n_tokens_neox': 576, 'n_words': 227}