File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,10 +22,9 @@ def get_ranked_dictionaries():
2222 # Do the expensive import here only
2323 from zxcvbn .frequency_lists import FREQUENCY_LISTS
2424
25- # Build the dictionary once
26- RANKED_DICTIONARIES = {}
27- for name , lst in FREQUENCY_LISTS .items ():
28- RANKED_DICTIONARIES [name ] = build_ranked_dict (lst )
25+ # Build in local scope before adding to global scope for thread safety
26+ built_dict = {name : build_ranked_dict (lst ) for name , lst in FREQUENCY_LISTS .items ()}
27+ RANKED_DICTIONARIES = built_dict
2928 return RANKED_DICTIONARIES
3029
3130
@@ -40,6 +39,7 @@ def wrapper(*args, **kwargs):
4039 return func (* args , ** kwargs )
4140 return wrapper
4241
42+
4343GRAPHS = {
4444 'qwerty' : adjacency_graphs .ADJACENCY_GRAPHS ['qwerty' ],
4545 'dvorak' : adjacency_graphs .ADJACENCY_GRAPHS ['dvorak' ],
You can’t perform that action at this time.
0 commit comments