Closed go-bro closed 7 years ago
It looks like both instances of ', '.join(Supplier.get_all_suppliers())
below should be replaced with ', '.join(candidates)
Happy to fork and fix if you guys are open to that 😺
cls.get_name() for cls in Supplier.get_all_suppliers()
) & set(spec.keys())
if not candidates:
raise ValueError('Missing the key naming the Supplier type from '
'an element of the "input" list. Valid keys are: {}'.format(
', '.join(Supplier.get_all_suppliers())
))
if len(candidates) > 1:
raise ValueError('Ambiguous supplier type in an element of the '
'"input" list. Exactly one of the following keys must be '
'present: {}'.format(', '.join(Supplier.get_all_suppliers())))```
Please feel free to fork and fix! It's pretty simple, but we need to fix both if
statements. I think the correct thing is:
if not candidates:
raise ValueError('Missing the key naming the Supplier type from '
'an element of the "input" list. Valid keys are: {}'.format(
', '.join(
cls.get_name() for cls in Supplier.get_all_suppliers()
)
))
if len(candidates) > 1:
raise ValueError('Ambiguous supplier type in an element of the '
'"input" list. Exactly one of the following keys must be '
'present: {}'.format(', '.join(candidates)))
I could just patch it, but feel free to fork and submit a PR so that you get credit for it.
I see, so the second case is where there are too many matches and the first case is where there are no matches.
This was fixed by #17
supplier.py:51
but Supplier.get_all_suppliers returns a list of types so you get this error: