<commit_before># -*- coding: utf-8 -*-
from blockdiag.noderenderer import install_renderer
from blockdiag.utils import renderer


def render_node(drawer, format, node, metrix, **kwargs):
    outline = kwargs.get('outline')
    font = kwargs.get('font')
    fill = kwargs.get('fill')
    badgeFill = kwargs.get('badgeFill')

    m = metrix.cell(node)

    if node.background:
        drawer.rectangle(m.box(), fill=node.color, outline=node.color)
        drawer.loadImage(node.background, m.box())
        drawer.rectangle(m.box(), outline=outline, style=node.style)
    else:
        drawer.rectangle(m.box(), outline=outline,
                         fill=node.color, style=node.style)

    drawer.textarea(m.coreBox(), node.label, fill=fill,
                    font=font, fontsize=metrix.fontSize,
                    lineSpacing=metrix.lineSpacing)

    if node.numbered != None:
        xy = m.topLeft()
        r = metrix.cellSize

        box = (xy.x - r, xy.y - r, xy.x + r, xy.y + r)
        drawer.ellipse(box, outline=fill, fill=badgeFill)
        drawer.textarea(box, node.numbered, fill=fill,
                        font=font, fontsize=metrix.fontSize)


def render_shadow(drawer, format, node, metrix, fill):
    box = metrix.cell(node).box()
    shadow = renderer.shift_box(box, metrix.shadowOffsetX,
                                metrix.shadowOffsetY)

    drawer.rectangle(shadow, fill=fill, filter='transp-blur')


def setup(self):
    install_renderer('box', self)<commit_msg> * Change to new style noderenderer: box<commit_after># -*- coding: utf-8 -*-
from blockdiag.noderenderer import NodeShape
from blockdiag.noderenderer import install_renderer
from blockdiag.utils.XY import XY


class Box(NodeShape):
    def render_shape(self, drawer, format, **kwargs):
        outline = kwargs.get('outline')
        font = kwargs.get('font')
        fill = kwargs.get('fill')

        # draw outline
        box = self.metrix.cell(self.node).box()
        if kwargs.get('shadow'):
            box = self.shift_shadow(box)
            drawer.rectangle(box, fill=fill, outline=fill,
                             filter='transp-blur')
        elif self.node.background:
            drawer.rectangle(box, fill=self.node.color,
                             outline=self.node.color)
            drawer.loadImage(self.node.background, box)
            drawer.rectangle(box, outline=outline, style=self.node.style)
        else:
            drawer.rectangle(box, fill=self.node.color, outline=outline,
                             style=self.node.style)

        # draw label
        textbox = self.metrix.cell(self.node).box()
        drawer.textarea(textbox, self.node.label, fill=fill,
                        font=font, fontsize=self.metrix.fontSize,
                        lineSpacing=self.metrix.lineSpacing)


def setup(self):
    install_renderer('box', Box)
{'fraction_non_alphanumeric': 0.12447844228094576, 'fraction_numerical': 0.0006954102920723226, 'mean_word_length': 2.3453488372093023, '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': '6519644', 'n_tokens_mistral': 889, 'n_tokens_neox': 883, 'n_words': 165}