<commit_before>import abc


class BaseMetadata(metaclass=abc.ABCMeta):

    def __init__(self, raw):
        self.raw = raw

    def serialized(self):
        return {
            'provider': self.provider,
            'kind': self.kind,
            'name': self.name,
            'path': self.path,
            'extra': self.extra,
        }

    @abc.abstractproperty
    def provider(self):
        pass

    @abc.abstractproperty
    def kind(self):
        pass

    @abc.abstractproperty
    def name(self):
        pass

    @abc.abstractproperty
    def path(self):
        pass

    @property
    def extra(self):
        return {}


class BaseFileMetadata(BaseMetadata, metaclass=abc.ABCMeta):

    def serialized(self):
        return dict(super().serialized(), **{
            'content_type': self.content_type,
            'modified': self.modified,
            'size': self.size,
        })

    @property
    def kind(self):
        return 'file'

    @abc.abstractproperty
    def content_type(self):
        pass<commit_msg>Impute slashes magically<commit_after>import abc


class BaseMetadata(metaclass=abc.ABCMeta):

    def __init__(self, raw):
        self.raw = raw

    def serialized(self):
        return {
            'provider': self.provider,
            'kind': self.kind,
            'name': self.name,
            'path': self.impute_slashes(self.path),
            'extra': self.extra,
        }

    def impute_slashes(self, path):
        if not path.startswith('/'):
            path = '/' + path
        if self.kind == 'folder' and not path.endswith('/'):
            path += '/'

        return path

    @abc.abstractproperty
    def provider(self):
        pass

    @abc.abstractproperty
    def kind(self):
        pass

    @abc.abstractproperty
    def name(self):
        pass

    @abc.abstractproperty
    def path(self):
        pass

    @property
    def extra(self):
        return {}


class BaseFileMetadata(BaseMetadata, metaclass=abc.ABCMeta):

    def serialized(self):
        return dict(super().serialized(), **{
            'contentType': self.content_type,
            'modified': self.modified,
            'size': self.size,
        })

    @property
    def kind(self):
        return 'file'

    @abc.abstractproperty
    def content_type(self):
        pass
{'fraction_non_alphanumeric': 0.11622901420576841, 'fraction_numerical': 0.0, 'mean_word_length': 1.8762376237623761, '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': '6484904', 'n_tokens_mistral': 688, 'n_tokens_neox': 664, 'n_words': 146}