stone_validators.py 文件源码

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

项目:DropboxConnect 作者: raguay 项目源码 文件源码
def apply(self, val):
        matches = self._get_matches(val)

        val_to_hash = str(val) if isinstance(val, int) or isinstance(val, float) else val

        try:
            # add string literal to ensure unicode
            hashed = hashlib.md5(val_to_hash.encode('utf-8')).hexdigest() + ''
        except [AttributeError, ValueError]:
            hashed = None

        if matches:
            blotted = '***'.join(matches.groups())
            if hashed:
                return '{} ({})'.format(hashed, blotted)
            return blotted
        return hashed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号