Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)

src/d/j/django-cachecow-HEAD/cachecow/decorators.py   django-cachecow(Download)
from django.utils import translation
 
from cachecow.cache import set_cache, make_key, key_arg_iterator
from cachecow.intpacker import pack_int
 
    key_args = map(call_if_callable, key_arg_iterator(key_args))
 
    return make_key(key_args, namespace=namespace, skip_prefix=skip_prefix)
 
 

src/d/j/django-cachecow-HEAD/cachecow/tests/tests.py   django-cachecow(Download)
from django.test import TestCase
 
from cachecow.cache import (make_key, _format_key_arg, timedelta_to_seconds,
                            invalidate_namespace, key_arg_iterator)
from cachecow.decorators import cached_function
    def test_short_key(self):
        args = ['foo', 'bar', 'b1z', 'qu ux']
        key = make_key(args)
        for arg in args:
            self.assertTrue(arg.replace(' ', '') in key)
 
    def test_unicode_obj_key(self):
        args = [u'foo', 'bar', u'baz']
        key = make_key(args)
    def test_no_brackets_in_list_key(self):
        key = make_key([1,2,3,4])
        self.assertTrue('[' not in key and ']' not in key)
 
    def test_long_key(self):
        args = range(2000)
        key = make_key(args)