util 模块¶
-
whoosh.util.fib(n)¶ 返回fibonacci序列中的第n个值。
-
whoosh.util.make_binary_tree(fn, args, **kwargs)¶ 获取一个函数/类,该函数/类接受两个位置参数和一个参数列表,并返回结果/实例的二进制树。
>>> make_binary_tree(UnionMatcher, [matcher1, matcher2, matcher3]) UnionMatcher(matcher1, UnionMatcher(matcher2, matcher3))
为该函数提供的任何关键字参数都将传递给类初始值设定项。
-
whoosh.util.make_weighted_tree(fn, ls, **kwargs)¶ 获取一个函数/类,该函数/类接受两个位置参数和一个(weight,argument)元组列表,并返回一个类似huffman的加权结果/实例树。
-
whoosh.util.synchronized(func)¶ 存储访问方法的修饰器,它在线程锁上进行同步。父对象必须具有'is_closed'和'u sync_lock'属性。
-
whoosh.util.unclosed(method)¶ decorator检查对象是否已关闭。