<commit_before>import datetime

from typing import Optional as _Optional


class Patch(object):
    def __init__(self, name: str, patch: str, start: datetime.date, end: _Optional[datetime.date]):
        self._name = name
        self._patch = patch
        self._start = start
        self._end = end

    @classmethod
    def from_str(cls, string):
        for patch in cls.__patches:
            if string in patch.name:
                return patch
        else:
            raise ValueError("Unknown patch name {}".format(string))

    @property
    def name(self):
        return self._name

    @property
    def patch(self):
        return self._patch

    @property
    def start(self):
        return self._start<commit_msg>Search by `patch.name` instead of `patch.version` in `Patch.from_str<commit_after>import datetime

from typing import Optional as _Optional


class Patch(object):
    def __init__(self, name: str, patch: str, start: datetime.date, end: _Optional[datetime.date]):
        self._name = name
        self._patch = patch
        self._start = start
        self._end = end

    @classmethod
    def from_str(cls, string):
        for patch in cls.__patches:
            if string in patch.patch:
                return patch
        else:
            raise ValueError("Unknown patch name {}".format(string))

    @property
    def name(self):
        return self._name

    @property
    def patch(self):
        return self._patch

    @property
    def start(self):
        return self._start
{'fraction_non_alphanumeric': 0.08792650918635171, 'fraction_numerical': 0.0, 'mean_word_length': 2.19706498951782, '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': '1418937', 'n_tokens_mistral': 423, 'n_tokens_neox': 410, 'n_words': 132}