<commit_before>from grapher import commons, errors
from grapher.repositories.base import EntityRepository


class CachedRepository(EntityRepository):
    data = {}

    def where(self, skip=0, limit=None, **query):
        return []

    def create(self, entities):
        result = []

        for entity in entities:
            self.data[entity[self.identity]] = entity
            del entity[self.identity]

            result.append(entity)<commit_msg> Update CacheRepository.where<commit_after>from grapher import commons, errors
from grapher.repositories.base import EntityRepository


class CachedRepository(EntityRepository):
    data = {}

    def where(self, skip=0, limit=None, **query):
        query_item = query.popitem()
        if query_item[0] == self.identity:
            return self.find((query_item[1]))

        return []

    def create(self, entities):
        result = []

        for entity in entities:
            self.data[entity[self.identity]] = entity
            del entity[self.identity]

            result.append(entity)
{'fraction_non_alphanumeric': 0.1021759697256386, 'fraction_numerical': 0.003784295175023652, 'mean_word_length': 2.712280701754386, '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': '3495042', 'n_tokens_mistral': 290, 'n_tokens_neox': 275, 'n_words': 70}