jaraco / wolframalpha

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError when attempting to access Pod.subpods

Harmon758 opened this issue · comments

#25 is an issue with v4.1.0 rather than with the API.

77bac9a changed

return map(cls, always_iterable(doc))
to use more_itertools.always_iterable rather than jaraco.itertools.always_iterable.

By default, jaraco.itertools.always_iterable treats a dictionary as a singleton, whereas more_itertools.always_iterable iterates over the dictionary's keys. This causes accessing Pod.subpods to error with ValueError: dictionary update sequence element #0 has length 1; 2 is required now, as when a subpod dictionary is passed to more_itertools.always_iterable, it will iterate over each of the keys, and when Subpod is initialized, it will attempt to cast each of those keys, rather than the entire subpod dictionary, to a dict.

It's so frustrating that although I contributed always_iterable to more_itertools, the implementation had to be tweaked to be less useful in situations like these.