tango_with_django_19 icon indicating copy to clipboard operation
tango_with_django_19 copied to clipboard

populate_rango.py cat_data["pages"]

Open jujes opened this issue 7 years ago • 1 comments

Hi, how fix it?

Expected 'collections.Iterable', got 'Union[List[Dict[str, Union[str, int]]], int]' instead less...

This inspection detects type errors in function call expressions. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Types of function parameters can be specified in docstrings or in Python 3 function annotations.

    for cat, cat_data in cats.items():
        # c = add_cat(cat)
        c = add_cat(cat, cat_data["views"], cat_data["likes"])
        for p in cat_data["pages"]:
            add_page(c, p["title"], p["url"], p["views"])

jujes avatar Mar 02 '17 13:03 jujes

Hi jujes,

That bit of code looks fine, I think the problem lies in your cats dictionary. If you haven't solved this one yet, could you paste that bit of code here?

I suspect you enclosed the cat items with square brackets instead of curly ones.

Regards, Iman

imanvanassum avatar Mar 05 '17 16:03 imanvanassum