__init__.py 文件源码

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

项目:python-qpass 作者: xolox 项目源码 文件源码
def simple_search(self, *keywords):
        """
        Perform a simple search for case insensitive substring matches.

        :param keywords: The string(s) to search for.
        :returns: The matched password names (a generator of strings).

        Only passwords whose names matches *all*  of the given keywords are
        returned.
        """
        matches = []
        keywords = [kw.lower() for kw in keywords]
        logger.verbose("Performing simple search on %s (%s) ..",
                       pluralize(len(keywords), "keyword"),
                       concatenate(map(repr, keywords)))
        for entry in self.entries:
            normalized = entry.name.lower()
            if all(kw in normalized for kw in keywords):
                matches.append(entry)
        logger.log(logging.INFO if matches else logging.VERBOSE,
                   "Matched %s using simple search.", pluralize(len(matches), "password"))
        return matches
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号