<commit_before># -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.

from __future__ import division

from .widgets.widget import Widget
from .visuals.visual import Visual
from ..util._logging import logger


class DrawingSystem(object):
    """ Simple implementation of a drawing engine. There is one system
    per viewbox.

    """
    def process(self, event, subscene):
        # Iterate over entities
        #assert isinstance(subscene, SubScene)  # LC: allow any part of the 
                                                #     scene to be drawn 
        self._process_entity(event, subscene, force_recurse=True)
    
    def _process_entity(self, event, entity, force_recurse=False):
        event.canvas._process_entity_count += 1

        # Push entity and set its total transform
        event.push_entity(entity)
        
        if isinstance(entity, Visual):
            try:
                entity.draw(event)
            except Exception:
                # get traceback and store (so we can do postmortem
                # debugging)<commit_msg>add import sys<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.

from __future__ import division

import sys

from .widgets.widget import Widget
from .visuals.visual import Visual
from ..util._logging import logger


class DrawingSystem(object):
    """ Simple implementation of a drawing engine. There is one system
    per viewbox.

    """
    def process(self, event, subscene):
        # Iterate over entities
        #assert isinstance(subscene, SubScene)  # LC: allow any part of the 
                                                #     scene to be drawn 
        self._process_entity(event, subscene, force_recurse=True)
    
    def _process_entity(self, event, entity, force_recurse=False):
        event.canvas._process_entity_count += 1

        # Push entity and set its total transform
        event.push_entity(entity)
        
        if isinstance(entity, Visual):
            try:
                entity.draw(event)
            except Exception:
                # get traceback and store (so we can do postmortem
                # debugging)
{'fraction_non_alphanumeric': 0.0756989247311828, 'fraction_numerical': 0.005161290322580645, 'mean_word_length': 2.1775956284153004, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1423218', 'n_tokens_mistral': 623, 'n_tokens_neox': 581, 'n_words': 213}