__init__.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:python-qpass 作者: xolox 项目源码 文件源码
def fuzzy_search(self, *filters):
        """
        Perform a "fuzzy" search that matches the given characters in the given order.

        :param filters: The pattern(s) to search for.
        :returns: The matched password names (a list of strings).
        """
        matches = []
        logger.verbose("Performing fuzzy search on %s (%s) ..",
                       pluralize(len(filters), "pattern"),
                       concatenate(map(repr, filters)))
        patterns = list(map(create_fuzzy_pattern, filters))
        for entry in self.entries:
            if all(p.search(entry.name) for p in patterns):
                matches.append(entry)
        logger.log(logging.INFO if matches else logging.VERBOSE,
                   "Matched %s using fuzzy search.", pluralize(len(matches), "password"))
        return matches
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号