<commit_before>"""GLX context creation and management.

Depends on the binary glxcontext module.

@todo: Include glxcontext in distribution as an optional module.

@author: <NAME>
@date: 2012-08-28
"""

try:
    from glxcontext import GLXContext as _GLXContext

    from glitter.contexts.context import Context

    class GLXContext(_GLXContext, Context):
        """Offscreen GLX context."""

        def __init__(self, **kwargs):
            _GLXContext.__init__(self, **kwargs)
            Context.__init__(self)
<commit_msg>GLX context now binds itself after creation<commit_after>"""GLX context creation and management.

Depends on the binary glxcontext module.

@todo: Include glxcontext in distribution as an optional module.

@author: <NAME>
@date: 2012-08-28
"""

try:
    from glxcontext import GLXContext as _GLXContext

    from glitter.contexts.context import Context
    from glitter.contexts.contextmanager import context_manager

    class GLXContext(_GLXContext, Context):
        """Offscreen GLX context."""

        def __init__(self, **kwargs):
            _GLXContext.__init__(self, **kwargs)
            Context.__init__(self)

            # TODO the lines below should not be necessary, or should at least be performed automatically by context_manager
            # XXX I would have expected it worked without these lines because of "with self._context" around GLObject functions; is this a problem with multiple Contexts?
            old_binding = context_manager.current_context
            if old_binding:
                old_binding._bind()
            else:
                context_manager.current_context = self

{'fraction_non_alphanumeric': 0.07369062119366626, 'fraction_numerical': 0.0097442143727162, 'mean_word_length': 3.0972568578553616, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2450924', 'n_tokens_mistral': 450, 'n_tokens_neox': 422, 'n_words': 153}