mirror of
https://github.com/simple-login/app.git
synced 2026-04-07 19:27:34 +00:00
Generate the word list in several lines
This commit is contained in:
+8117
-1
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")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user