示例#1
0
    def find_path(self, path):
        node_set = ffi.gc(lib.ly_ctx_find_path(self._ctx, str2c(path)),
                          lib.ly_set_free)
        if not node_set:
            raise self.error('cannot find path')

        for i in range(node_set.number):
            yield Node.new(self, node_set.set.s[i])
示例#2
0
 def find_path(self, path):
     if self._ctx is None:
         raise RuntimeError('context already destroyed')
     node_set = lib.ly_ctx_find_path(self._ctx, str2c(path))
     if not node_set:
         raise self.error('cannot find path')
     try:
         for i in range(node_set.number):
             yield SNode.new(self, node_set.set.s[i])
     finally:
         lib.ly_set_free(node_set)
示例#3
0
 def find_path(self, path: str) -> Iterator[SNode]:
     if self.cdata is None:
         raise RuntimeError("context already destroyed")
     node_set = lib.ly_ctx_find_path(self.cdata, str2c(path))
     if not node_set:
         raise self.error("cannot find path")
     try:
         for i in range(node_set.number):
             yield SNode.new(self, node_set.set.s[i])
     finally:
         lib.ly_set_free(node_set)