Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions zxcvbn/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ def get_ranked_dictionaries():
# Do the expensive import here only
from zxcvbn.frequency_lists import FREQUENCY_LISTS

# Build the dictionary once
RANKED_DICTIONARIES = {}
for name, lst in FREQUENCY_LISTS.items():
RANKED_DICTIONARIES[name] = build_ranked_dict(lst)
# Build in local scope before adding to global scope for thread safety
built_dict = {name: build_ranked_dict(lst) for name, lst in FREQUENCY_LISTS.items()}
RANKED_DICTIONARIES = built_dict
return RANKED_DICTIONARIES


Expand Down