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

import os
import shutil
import tempfile
import time
import unittest
import warnings

import dache

from six.moves import cPickle as pickle

from dache import CacheKeyWarning


# functions/classes for complex data type tests
def f():
    return 42


class C:
    def m(n):
        return 24


class Unpickable(object):
    def __getstate__(self):
        raise pickle.PickleError()


class TestLocMemCache(unittest.TestCase):

    CACHE_URL = 'locmem://'

    def setUp(self):
        self.cache = dache.Cache(self.CACHE_URL)

    def tearDown(self):
        self.cache.clear()
        self.cache.close()

    def test_simple(self):
        # Simple cache set/get works
        self.self.cache.set('key', 'value')
        self.assertEqual(self.self.cache.get('key'), 'value')

    def test_add(self):
        # A key can be added to a cache
        self.cache.add("addkey1", "value")
        result = self.cache.add("addkey1", "newvalue")
        self.assertFalse(result)
        self.assertEqual(self.cache.get("addkey1"), "value")
<commit_msg>Fix typo<commit_after># -*- coding: utf-8 -*-

import os
import shutil
import tempfile
import time
import unittest
import warnings

import dache

from six.moves import cPickle as pickle

from dache import CacheKeyWarning


# functions/classes for complex data type tests
def f():
    return 42


class C:
    def m(n):
        return 24


class Unpickable(object):
    def __getstate__(self):
        raise pickle.PickleError()


class TestLocMemCache(unittest.TestCase):

    CACHE_URL = 'locmem://'

    def setUp(self):
        self.cache = dache.Cache(self.CACHE_URL)

    def tearDown(self):
        self.cache.clear()
        self.cache.close()

    def test_simple(self):
        # Simple cache set/get works
        self.cache.set('key', 'value')
        self.assertEqual(self.cache.get('key'), 'value')

    def test_add(self):
        # A key can be added to a cache
        self.cache.add("addkey1", "value")
        result = self.cache.add("addkey1", "newvalue")
        self.assertFalse(result)
        self.assertEqual(self.cache.get("addkey1"), "value")

{'fraction_non_alphanumeric': 0.11704598235020901, 'fraction_numerical': 0.0074314909428704135, 'mean_word_length': 2.7922535211267605, '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': '5283288', 'n_tokens_mistral': 703, 'n_tokens_neox': 670, 'n_words': 179}