<commit_before>#!/usr/bin/env python3

import time
import subprocess
import sys
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler

# get test name (or parts of it) from first command parameter, other leave it empty (and don't run tests)
testName = sys.argv[1] if len(sys.argv) > 1 else ''

# ERROR | WARN | INFO | DEBUG | TRACE
logLevel = 'ERROR'

sourceDirectory = 'src/'
workingDirectory = None

def buildAntTest():
    # compile
    result = subprocess.call(['scons', '--optimize=O', '--target=Tests'], cwd = workingDirectory)

    # run test to if compilation was successful and a test name was specified
    if result == 0 and len(testName) > 0:
        subprocess.call(['./NetworKit-Tests-O', '--tests', '--loglevel=' + logLevel, '--gtest_filter=*' + testName + '*'], cwd = workingDirectory)
    print("\nWaiting for code changes...")

if __name__ == "__main__":
    buildAntTest()

    class ContinousTesting(PatternMatchingEventHandler):
        def __init__(self):
            super(ContinousTesting, self).__init__(patterns = ['*.h', '*.cpp'])
        
        def on_any_event(self, event):
            buildAntTest()
    
    event_handler = ContinousTesting()

    observer = Observer()
    observer.schedule(event_handler, path = sourceDirectory, recursive = True)
    observer.start()

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()

    observer.join()
<commit_msg>continous testing now uses 4 jobs for compilation<commit_after>#!/usr/bin/env python3

import time
import subprocess
import sys
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler

# get test name (or parts of it) from first command parameter, other leave it empty (and don't run tests)
testName = sys.argv[1] if len(sys.argv) > 1 else ''

# ERROR | WARN | INFO | DEBUG | TRACE
logLevel = 'ERROR'

sourceDirectory = 'src/'
workingDirectory = None

def buildAntTest():
    # compile
    result = subprocess.call(['scons', '--optimize=O', '--target=Tests', '-j 4'], cwd = workingDirectory)

    # run test to if compilation was successful and a test name was specified
    if result == 0 and len(testName) > 0:
        subprocess.call(['./NetworKit-Tests-O', '--tests', '--loglevel=' + logLevel, '--gtest_filter=*' + testName + '*'], cwd = workingDirectory)
    print("\nWaiting for code changes...")

if __name__ == "__main__":
    buildAntTest()

    class ContinousTesting(PatternMatchingEventHandler):
        def __init__(self):
            super(ContinousTesting, self).__init__(patterns = ['*.h', '*.cpp'])
        
        def on_any_event(self, event):
            buildAntTest()
    
    event_handler = ContinousTesting()

    observer = Observer()
    observer.schedule(event_handler, path = sourceDirectory, recursive = True)
    observer.start()

    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()

    observer.join()

{'fraction_non_alphanumeric': 0.12243547319655856, 'fraction_numerical': 0.004632693580410324, 'mean_word_length': 3.2758132956152757, 'pattern_counts': {'":': 2, '<': 3, '<?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': '1124650', 'n_tokens_mistral': 901, 'n_tokens_neox': 876, 'n_words': 261}