<commit_before>if "bpy" in locals():
    import imp
    imp.reload(socket_api)
    imp.reload(_converters)
    imp.reload(processors)
else:
    import bpy
    from . import socket_api
    from . import converters as _converters
    from . import processors

import os
import socket
import struct
import subprocess
import sys
import time
import collections

import bpy
import mathutils

from OpenGL.GL import *


DEFAULT_WATCHLIST = [
    #"actions",
    #"armatures",
    "cameras",
    "images",
    "lamps",
    "materials",
    "meshes",
    "objects",
    "scenes",
    #"sounds",
    #"speakers",
    "textures",
    #"worlds",
]


class _BaseFunc:
    def __call__(self, data_set):
        pass

ViewportTuple = collections.namedtuple('Viewport', ('height', 'width'))

def get_collection_name(collection):
    class_name = collection.rna_type.__class__.__name__
    clean_name = class_name.replace("BlendData", "").lower()
    return clean_name


class RealTimeEngine():
    bl_idname = 'RTE_FRAMEWORK'
    bl_label = "Real Time Engine Framework"

    def __init__(self, program=[], watch_list=DEFAULT_WATCHLIST, converter=None,
            processor=None):
        # Display image
        self.width = 1
        self.height = 1
        self.clock = time.perf_counter()

        self.draw_lock = False
        self.override_context = None

        self.converter = converter if converter else _converters.BTFConverter()
        if processor is None:
            self.display = processors.DoubleBuffer(3, self.draw_callback)
            self.processor = processors.DummyProcessor(self.display)
        else:
            self.processor = processor

        self.remove_delta = {}
        self.add_delta = {}
        self.update_delta = {}
        self.view_delta = {}

        self._watch_list = [getattr(bpy.data, i) for i in watch_list]

        self._tracking_sets = {}
        for collection in self._watch_list:
            collection_name = get_collection_name(collection)
            self._tracking_sets[collection_name] = set()

        self._old_vmat = None
        self._old_pmat = None
        self._old_viewport = None


        def main_loop(scene):
            try:
                new_time = time.perf_counter()
                dt = new_time - self.clock
                self.clock = new_time
                self.main_update(dt)
            except ReferenceError:
                bpy.app.handlers.scene_update_post.remove(main_loop)

        bpy.app.handlers.scene_update_post.append(main_loop)

        self.tex = glGenTextures(1)

    def view_update(self, context):
        """ Called when the scene is changed """

        for collection in self._watch_list:<commit_msg>Change RealTimeEngine constructor to use keyword arguments<commit_after>if "bpy" in locals():
    import imp
    imp.reload(socket_api)
    imp.reload(_converters)
    imp.reload(processors)
else:
    import bpy
    from . import socket_api
    from . import converters as _converters
    from . import processors

import os
import socket
import struct
import subprocess
import sys
import time
import collections

import bpy
import mathutils

from OpenGL.GL import *


DEFAULT_WATCHLIST = [
    #"actions",
    #"armatures",
    "cameras",
    "images",
    "lamps",
    "materials",
    "meshes",
    "objects",
    "scenes",
    #"sounds",
    #"speakers",
    "textures",
    #"worlds",
]


class _BaseFunc:
    def __call__(self, data_set):
        pass

ViewportTuple = collections.namedtuple('Viewport', ('height', 'width'))

def get_collection_name(collection):
    class_name = collection.rna_type.__class__.__name__
    clean_name = class_name.replace("BlendData", "").lower()
    return clean_name


class RealTimeEngine():
    bl_idname = 'RTE_FRAMEWORK'
    bl_label = "Real Time Engine Framework"

    def __init__(self, **kwargs):
        # Display image
        self.width = 1
        self.height = 1
        self.clock = time.perf_counter()

        self.draw_lock = False
        self.override_context = None

        if 'converter' in kwargs:
            self.converter = converter
        else:
            self.converter = _converters.BTFConverter()

        if 'processor' in kwargs:
            self.processor = kwargs['processor']
        else:
            self.display = processors.DoubleBuffer(3, self.draw_callback)
            self.processor = processors.DummyProcessor(self.display)

        self.remove_delta = {}
        self.add_delta = {}
        self.update_delta = {}
        self.view_delta = {}

        watch_list = kwargs['watch_list'] if 'watch_list' in kwargs else DEFAULT_WATCHLIST
        self._watch_list = [getattr(bpy.data, i) for i in watch_list]

        self._tracking_sets = {}
        for collection in self._watch_list:
            collection_name = get_collection_name(collection)
            self._tracking_sets[collection_name] = set()

        self._old_vmat = None
        self._old_pmat = None
        self._old_viewport = None


        def main_loop(scene):
            try:
                new_time = time.perf_counter()
                dt = new_time - self.clock
                self.clock = new_time
                self.main_update(dt)
            except ReferenceError:
                bpy.app.handlers.scene_update_post.remove(main_loop)

        bpy.app.handlers.scene_update_post.append(main_loop)

        self.tex = glGenTextures(1)

    def view_update(self, context):
        """ Called when the scene is changed """

        for collection in self._watch_list:
{'fraction_non_alphanumeric': 0.09482446615997105, 'fraction_numerical': 0.0014477017734346724, 'mean_word_length': 2.3845682792406615, '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': '1300681', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1618, 'n_words': 369}