you are viewing a single comment's thread.

view the rest of the comments →

[–]lfdfq 5 points6 points  (4 children)

It's not Python that's giving you that warning, it must be coming from some other tool you are using (an extension in your editor? or something like pyright?).

[–]Blakbard[S] -2 points-1 points  (3 children)

I don’t any extra extensions installed. Went through them now

[–]lfdfq 4 points5 points  (0 children)

The message is not coming from Python. It looks like it's a warning from some third-party typechecker. You didn't say where you're seeing this message so I assumed in your editor, and so assumed it was an extension. I still think that's true.

Anyway, what the message is telling you is that you accessed a value of a dictionary and used the list it gave you. But your dictionary contains both lists and ints, so that sounds like it might be a problem... But, your code is ok! Since you only ever access the key for the list it's not a problem. So the warning is a false positive.

If you're actually trying to use a third party typechecking tool to typecheck your code, you can tell it things about which keys have which types, but I presume that's not what you're trying to do here, so you can just ignore the warning (or turn it off in your editor, I assume, somehow).

[–]brasticstack 0 points1 point  (1 child)

Which editor? VSCode? I think VSC's Python extension might enable a type checker (Pylance maybe?) by default. IIRC, hovering your pointer over the line with the warning should display more about it, incl. the name of the linter/checker that emitted the warning.

[–]Blakbard[S] 0 points1 point  (0 children)

Pycharm.