예제 #1
0
def test_specialize_decorator():
    def f():
        pass

    specialize.memo()(f)

    assert f._annspecialcase_ == 'specialize:memo'

    specialize.arg(0)(f)

    assert f._annspecialcase_ == 'specialize:arg(0)'

    specialize.arg(1)(f)

    assert f._annspecialcase_ == 'specialize:arg(1)'
예제 #2
0
def test_specialize_decorator():
    def f():
        pass

    specialize.memo()(f)

    assert f._annspecialcase_ == 'specialize:memo'

    specialize.arg(0)(f)

    assert f._annspecialcase_ == 'specialize:arg(0)'

    specialize.arg(1)(f)

    assert f._annspecialcase_ == 'specialize:arg(1)'
예제 #3
0
 def __init__(self, space):
     if self.built:
         return
     self.built = True
     cache = {}
     for cls, it in all_types._items:
         if it == 'complex':
             cache[cls] = make_sort_function(space, cls, it, 2)
         else:
             cache[cls] = make_sort_function(space, cls, it)
     self.cache = cache
     self._lookup = specialize.memo()(lambda tp: cache[tp[0]])
예제 #4
0
파일: selection.py 프로젝트: sota/pypy-old
 def __init__(self, space):
     if self.built:
         return
     self.built = True
     cache = {}
     for cls, it in all_types._items:
         if it == 'complex':
             cache[cls] = make_sort_function(space, cls, it, 2)
         else:
             cache[cls] = make_sort_function(space, cls, it)
     self.cache = cache
     self._lookup = specialize.memo()(lambda tp: cache[tp[0]])