From 2aeccc9022ca7984af27a0dd372e89e573158a62 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Thu, 7 Nov 2024 18:27:19 -0600 Subject: move wordlist to python list approach --- yoshi/process.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'yoshi/process.py') diff --git a/yoshi/process.py b/yoshi/process.py index 107abfc..dabce86 100644 --- a/yoshi/process.py +++ b/yoshi/process.py @@ -29,7 +29,7 @@ import uuid from prettytable import PrettyTable from yoshi.account import Account from yoshi import database - +from yoshi.wordlist import WORDLIST def generate_characters(n: int) -> list: """ @@ -78,13 +78,11 @@ def generate_passphrase(n: int, sep: str) -> str: phrases = [] lucky_number = random.choice(range(0, n)) for _ in range(n): - with open('wordlist.txt', 'r', encoding='utf-8') as file: - line = random.choice(file.readlines()) - line = line.replace('\n', '') + word = random.choice(WORDLIST) if _ == lucky_number: - phrases.append(line.strip().capitalize() + str(_)) + phrases.append(word.capitalize() + str(_)) else: - phrases.append(line.strip().capitalize()) + phrases.append(word.capitalize()) passphrase = sep.join(phrases) return passphrase -- cgit v1.2.3-70-g09d2