[fix] alternatives lists in config utils
This commit is contained in:
@@ -33,7 +33,7 @@ def nested_get(obj, keys, default=DoesNotExist):
|
|||||||
|
|
||||||
def alternative_probabilities(properties):
|
def alternative_probabilities(properties):
|
||||||
if properties is None:
|
if properties is None:
|
||||||
return None
|
return None, None
|
||||||
|
|
||||||
probs = []
|
probs = []
|
||||||
alternatives = []
|
alternatives = []
|
||||||
@@ -43,11 +43,13 @@ def alternative_probabilities(properties):
|
|||||||
props = properties['default']
|
props = properties['default']
|
||||||
probs.append(prob)
|
probs.append(prob)
|
||||||
alternatives.append(props)
|
alternatives.append(props)
|
||||||
elif 'alternatives' not in properties:
|
elif 'alternatives' not in properties and 'default' in properties:
|
||||||
prob = 1.0
|
prob = 1.0
|
||||||
props = properties['default']
|
props = properties['default']
|
||||||
probs.append(prob)
|
probs.append(prob)
|
||||||
alternatives.append(props)
|
alternatives.append(props)
|
||||||
|
elif 'alternatives' not in properties and 'default' not in properties:
|
||||||
|
return None, None
|
||||||
|
|
||||||
alts = properties.get('alternatives', [])
|
alts = properties.get('alternatives', [])
|
||||||
for alt in alts:
|
for alt in alts:
|
||||||
|
|||||||
Reference in New Issue
Block a user