parsers.py 文件源码

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

项目:otree_virtual_machine_manager 作者: tobiasraabe 项目源码 文件源码
def parse_password(password: str) -> str:
    """Checks if ``password`` is suffiently strong.

    Parameters
    ----------
    password : str
        Possible password.

    Returns
    -------
    password : str
        Valid password.

    Raises:
    click.BadParameter
        If password is not sufficiently strong.

    """
    if password in ['password', 'hallo123', 'admin']:
        raise click.BadParameter('ERROR: You are kidding, right?')
    elif re.fullmatch(r'[A-Za-z0-9]{{{},}}'.format(PASSWORD_LENGTH), password):
        return password
    else:
        raise click.BadParameter('ERROR: Use only alphanumeric characters.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号