santit96's picture
Fix code style with black and isort
c412087
import os
import urllib.request
_COMPLETE_VOCABULARY_URL = "https://gist.githubusercontent.com/scholtes/\
94f3c0303ba6a7768b47583aff36654d/raw/\
d9cddf5e16140df9e14f19c2de76a0ef36fd2748/wordle-Ta.txt"
_TARGET_VOCABULARY_URL = "https://gist.githubusercontent.com/scholtes/\
94f3c0303ba6a7768b47583aff36654d/raw/\
d9cddf5e16140df9e14f19c2de76a0ef36fd2748/wordle-La.txt"
_DOWNLOADS_DIR = "."
_COMPLETE_VOCABULARY_FILENAME = "complete_vocabulary.txt"
_TARGET_VOCABULARY_FILENAME = "target_vocabulary.txt"
def _retrieve_vocabulary(url, filename, dir):
vocabulary_file = os.path.join(dir, filename)
# Download the file if it does not exist
if not os.path.isfile(vocabulary_file):
urllib.request.urlretrieve(url, vocabulary_file)
with open(vocabulary_file) as file:
return [line.rstrip().upper() for line in file]
target_vocabulary = _retrieve_vocabulary(
_TARGET_VOCABULARY_URL, _TARGET_VOCABULARY_FILENAME, _DOWNLOADS_DIR
)
complete_vocabulary = (
_retrieve_vocabulary(
_COMPLETE_VOCABULARY_URL, _COMPLETE_VOCABULARY_FILENAME, _DOWNLOADS_DIR
)
+ target_vocabulary
)