diff options
author | Christian Cleberg <hello@cleberg.net> | 2024-11-07 18:27:19 -0600 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2024-11-07 18:27:19 -0600 |
commit | 2aeccc9022ca7984af27a0dd372e89e573158a62 (patch) | |
tree | 40d3d3be91e845db200489c657e34f604cdc2734 /yoshi/process.py | |
parent | 7199ea19bfd998f620331a9983284666eed1d935 (diff) | |
download | yoshi-cli-2aeccc9022ca7984af27a0dd372e89e573158a62.tar.gz yoshi-cli-2aeccc9022ca7984af27a0dd372e89e573158a62.tar.bz2 yoshi-cli-2aeccc9022ca7984af27a0dd372e89e573158a62.zip |
move wordlist to python list approach
Diffstat (limited to 'yoshi/process.py')
-rw-r--r-- | yoshi/process.py | 10 |
1 files changed, 4 insertions, 6 deletions
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 |