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.')
parsers.py 文件源码
python
阅读 37
收藏 0
点赞 0
评论 0
评论列表
文章目录