From: Andrew Grimberg Date: Tue, 10 Oct 2023 13:23:15 +0000 (-0700) Subject: Refactor: Add annotations to lftools.helpers X-Git-Tag: v0.37.7~2^2~1 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=bcb4bb79569ececb5f66df5da2f04320846cfdda;p=releng%2Flftools.git Refactor: Add annotations to lftools.helpers Issue: RELENG-4933 Signed-off-by: Andrew Grimberg Change-Id: I28a94f82c6fdb04380cb2bc731ebc13811157ceb --- diff --git a/lftools/helpers.py b/lftools/helpers.py index be7ff868..fa36dc7a 100644 --- a/lftools/helpers.py +++ b/lftools/helpers.py @@ -9,12 +9,13 @@ ############################################################################## """Nexus3 REST API interface.""" +from __future__ import annotations import random import string -def generate_password(length=12): - punctuation = "!#$%&()*+,-.:;<=>?@[]^_{|}~" - password_characters = string.ascii_letters + string.digits + punctuation +def generate_password(length: int = 12) -> str: + punctuation: str = "!#$%&()*+,-.:;<=>?@[]^_{|}~" + password_characters: str = string.ascii_letters + string.digits + punctuation return "".join(random.choice(password_characters) for _ in range(length))