<commit_before># -*- coding: utf-8 -*-
"""
Created on Tue May  5 14:44:57 2015

@author: oscar
"""

from docutils import nodes
from sphinx import addnodes
from sphinx.util import ws_re
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.images import Figure


class GlrThumb(Figure):

    option_spec = Figure.option_spec.copy()
    option_spec['reftarget'] = directives.unchanged_required

    def run(self):
        tar = self.options.pop('reftarget')
        target = ws_re.sub(' ', tar)
#        reference_node = addnodes.pending_xref(reftype='doc',
#                                               reftarget=target,
#                                               refexplicit='')
        (figure_node, ) = Figure.run(self)
        if isinstance(figure_node, nodes.system_message):
            return [figure_node]

#        reference_node += figure_node

#        return [reference_node]
        return [figure_node]
def setup(app):

    app.add_node(glr_thumb, html=(visit_glr_thumb_node, depart_glr_thumb_node))
    app.add_directive('glr_thumb', GlrThumb)<commit_msg>write nodes prototypes<commit_after># -*- coding: utf-8 -*-
"""
Created on Tue May  5 14:44:57 2015

@author: oscar
"""

from docutils import nodes
from sphinx import addnodes
from sphinx.util import ws_re
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.images import Figure


class glr_thumb(nodes.General, nodes.Element):
    pass


def visit_glr_thumb_node(self, node):
    pass


def depart_glr_thumb_node(self, node):
    pass


class GlrThumb(Figure):

    option_spec = Figure.option_spec.copy()
    option_spec['reftarget'] = directives.unchanged_required

    def run(self):
        tar = self.options.pop('reftarget')
        target = ws_re.sub(' ', tar)
#        reference_node = addnodes.pending_xref(reftype='doc',
#                                               reftarget=target,
#                                               refexplicit='')
        (figure_node, ) = Figure.run(self)
        if isinstance(figure_node, nodes.system_message):
            return [figure_node]

#        reference_node += figure_node

#        return [reference_node]
        return [figure_node]
def setup(app):

    app.add_node(glr_thumb, html=(visit_glr_thumb_node, depart_glr_thumb_node))
    app.add_directive('glr_thumb', GlrThumb)
{'fraction_non_alphanumeric': 0.10286677908937605, 'fraction_numerical': 0.01011804384485666, 'mean_word_length': 2.6905132192846035, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5079279', 'n_tokens_mistral': 761, 'n_tokens_neox': 711, 'n_words': 151}