<commit_before>import numpy as np

from c3nav.mapdata.render.engines import register_engine
from c3nav.mapdata.render.engines.base3d import Base3DEngine


@register_engine
class OpenSCADEngine(Base3DEngine):
    filetype = 'scad'

    def _create_polyhedron(self, name, vertices):
        facets = np.vstack(vertices)
        vertices = tuple(set(tuple(vertex) for vertex in facets.reshape((-1, 3))))
        lookup = {vertex: i for i, vertex in enumerate(vertices)}

        return (b'module ' + name.replace('-', 'minus').encode() + b'() {\n' +
                b'  polyhedron(\n' +
                b'    points = [\n' +
                b'\n'.join((b'      [%.3f, %.3f, %.3f],' % tuple(vertex)) for vertex in vertices) + b'\n' +
                b'    ],\n' +
                b'    faces = [\n' +
                b'\n'.join((b'      [%d, %d, %d],' % (lookup[tuple(a)], lookup[tuple(b)], lookup[tuple(c)]))
                           for a, b, c in facets) + b'\n' +
                b'    ],\n' +
                b'    convexity = 10\n' +
                b'  );\n'
                b'}\n')

    def render(self) -> bytes:
        result = (b'c3nav_export();\n\n' +
                  b'module c3nav_export() {\n' +
                  b'\n'.join((b'  %s();' % group.replace('-', 'minus').encode())
                             for group in self.groups.keys()) + b'\n' +
                  b'}\n\n')
        for group, subgroups in self.groups.items():<commit_msg>fix linter issue in pycharm<commit_after>import numpy as np

from c3nav.mapdata.render.engines import register_engine
from c3nav.mapdata.render.engines.base3d import Base3DEngine


@register_engine
class OpenSCADEngine(Base3DEngine):
    filetype = 'scad'

    def _create_polyhedron(self, name, vertices):
        facets = np.vstack(vertices)
        vertices = tuple(set(tuple(vertex) for vertex in facets.reshape((-1, 3))))
        lookup = {vertex: i for i, vertex in enumerate(vertices)}

        return (b'module ' + name.replace('-', 'minus').encode() + b'() {\n' +
                b'  polyhedron(\n' +
                b'    points = [\n' +
                b'\n'.join((b'      [%.3f, %.3f, %.3f],' % tuple(vertex)) for vertex in vertices) + b'\n' +
                b'    ],\n' +
                b'    faces = [\n' +
                b'\n'.join((b'      [%d, %d, %d],' % (lookup[tuple(a)], lookup[tuple(b)], lookup[tuple(c)]))
                           for a, b, c in facets) + b'\n' +
                b'    ],\n' +
                b'    convexity = 10\n' +
                b'  );\n'
                b'}\n')

    def render(self) -> bytes:
        result = (b'c3nav_export();\n\n' +
                  b'module c3nav_export() {\n' +
                  b'\n'.join((b'  %s();' % group.replace('-', 'minus').encode())
                             for group in self.groups.keys()) + b'\n' +
                  b'}\n\n')
        for group, subgroups in self.groups.items():
            # noinspection PyStringFormat
{'fraction_non_alphanumeric': 0.17272727272727273, 'fraction_numerical': 0.009427609427609427, 'mean_word_length': 1.6574239713774597, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '665044', 'n_tokens_mistral': 1027, 'n_tokens_neox': 962, 'n_words': 223}