mirror of
https://github.com/simple-login/app.git
synced 2025-02-21 22:32:56 +08:00
Generate the word list in several lines
This commit is contained in:
parent
23796197f7
commit
7fd4b1d2ee
2 changed files with 8126 additions and 8 deletions
8118
app/words.py
8118
app/words.py
File diff suppressed because one or more lines are too long
|
@ -10,16 +10,18 @@ from app import config # noqa: E402
|
|||
from app.log import LOG # noqa: E402
|
||||
|
||||
LOG.i(f"Reading {config.WORDS_FILE_PATH} file")
|
||||
words = [
|
||||
word.strip()
|
||||
for word in open(config.WORDS_FILE_PATH, "r").readlines()
|
||||
if word.strip()
|
||||
]
|
||||
words = sorted(
|
||||
[
|
||||
word.strip()
|
||||
for word in open(config.WORDS_FILE_PATH, "r").readlines()
|
||||
if word.strip()
|
||||
]
|
||||
)
|
||||
|
||||
destFile = os.path.join(rootDir, "app", "words.py")
|
||||
LOG.i(f"Writing {destFile}")
|
||||
|
||||
serialized_words = json.dumps(words)
|
||||
serialized_words = json.dumps(words, indent=2)
|
||||
with open(destFile, "wb") as fd:
|
||||
fd.write(
|
||||
f"""#
|
||||
|
@ -29,7 +31,7 @@ with open(destFile, "wb") as fd:
|
|||
import json
|
||||
|
||||
safe_words = json.loads(
|
||||
'{serialized_words}'
|
||||
\"\"\"{serialized_words}\"\"\"
|
||||
)
|
||||
""".encode("utf-8")
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue