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

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)

        def pack_int(n):
    s = []
    while True:
        n, r = divmod(n, _BASE)
        s.append(_ALPHABET[r])
        if n == 0:
            break
        elif n == -1:
            s.append('-')
            break
    return ''.join(reversed(s))
        


src/d/j/django-cachecow-HEAD/cachecow/decorators.py   django-cachecow(Download)
 
from cachecow.cache import set_cache, make_key, key_arg_iterator
from cachecow.intpacker import pack_int
 
 
    # It's fine to memoize functions that collide on this as if
    # they are one, since they're identical if their codeblock hash is the same.
    key_args.append(pack_int(func.__code__.__hash__()))
    return key_args
 

src/d/j/django-cachecow-HEAD/cachecow/cache.py   django-cachecow(Download)
from django.core import cache
 
from cachecow.intpacker import pack_int
 
 
 
    # Compact the key before returning it to save space when using it.
    return pack_int(ns_prefix)
 
 

src/d/j/django-cachecow-HEAD/cachecow/tests/tests.py   django-cachecow(Download)
                            invalidate_namespace, key_arg_iterator)
from cachecow.decorators import cached_function
from cachecow.intpacker import pack_int, unpack_int
 
 
    def test_int_packer(self):
        self.assertEqual(pack_int(0), 'A')
        for i in [-200,-10,-5,-4, -3, -2, -1, 0]:
            pack_int(i)