Ejemplo n.º 1
0
 def __contains__(self, item):
     obj = capi.nl_cache_search(self._nl_cache, item._nl_object)
     if obj is None:
         return False
     else:
         capi.nl_object_put(obj)
         return True
Ejemplo n.º 2
0
	def __contains__(self, item):
        	obj = capi.nl_cache_search(self._nl_cache, item._nl_object)
                if obj is None:
                        return False
                else:
                        capi.nl_object_put(obj)
                        return True
Ejemplo n.º 3
0
    def next(self):
        if self._end:
            raise StopIteration()

        if self._first:
            ret = self._nl_object
            self._first = 0
        else:
            ret = self.get_next()
            if not ret:
                self._end = 1
                raise StopIteration()

        # return ref of previous element and acquire ref of current
        # element to have object stay around until we fetched the
        # next ptr
        capi.nl_object_put(self._nl_object)
        capi.nl_object_get(ret)
        self._nl_object = ret

        # reference used inside object
        capi.nl_object_get(ret)
        return self._cache._new_object(ret)
Ejemplo n.º 4
0
 def __del__(self):
     if self._nl_object:
         capi.nl_object_put(self._nl_object)
Ejemplo n.º 5
0
    def __del__(self):
        if not self._nl_object:
            raise ValueError()

        capi.nl_object_put(self._nl_object)