Skip to content

Commit

Permalink
Merge pull request #93 from vaibhavsingh97/chore/optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavsingh97 authored Nov 17, 2024
2 parents ad2ed0f + d86a8e3 commit 9b81216
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions random_word/services/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
class Local(object):
def __init__(self):
self.source = join(dirname(__file__), "..", "database", "words.json")
with open(self.source) as word_database:
self.valid_words = load(word_database)

def get_random_word(self):
with open(self.source) as word_database:
valid_words = load(word_database)
return secrets.choice(list(valid_words.keys()))
return secrets.choice(list(self.valid_words.keys()))

0 comments on commit 9b81216

Please sign in to comment.