<commit_before># -*- coding: utf-8 -*-

import re
import uuid

from abc import ABCMeta, abstractmethod

import numpy as np


class BaseReader(object):
    __metaclass__ = ABCMeta

    @abstractmethod
    def __init__(self):
        pass

    @abstractmethod
    def _to_raw_pyfrm(self):
        pass

    def _optimize(self, mesh):
        # Sort interior interfaces
        for f in filter(lambda f: re.match(r'^con_p\d+$', f), mesh):
            mesh[f] = mesh[f][:,np.argsort(mesh[f][0])]

    def to_pyfrm(self):
        mesh = self._to_raw_pyfrm()

        # Perform some simple optimizations on the mesh
        self._optimize(mesh)

        # Add metadata
        mesh['mesh_uuid'] = str(uuid.uuid4())

        return mesh<commit_msg>Cleanups.<commit_after># -*- coding: utf-8 -*-

import re
import uuid

from abc import ABCMeta, abstractmethod

import numpy as np


class BaseReader(object):
    __metaclass__ = ABCMeta

    @abstractmethod
    def __init__(self):
        pass

    @abstractmethod
    def _to_raw_pyfrm(self):
        pass

    def _optimize(self, mesh):
        # Sort interior interfaces
        for f in filter(lambda f: re.match(r'con_p\d+$', f), mesh):
            mesh[f] = mesh[f][:,np.argsort(mesh[f][0])]

    def to_pyfrm(self):
        mesh = self._to_raw_pyfrm()

        # Perform some simple optimizations on the mesh
        self._optimize(mesh)

        # Add metadata
        mesh['mesh_uuid'] = str(uuid.uuid4())

        return mesh
{'fraction_non_alphanumeric': 0.11238997968855789, 'fraction_numerical': 0.004062288422477996, 'mean_word_length': 2.453271028037383, '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': '4970543', 'n_tokens_mistral': 493, 'n_tokens_neox': 475, 'n_words': 123}