Last active
July 30, 2019 13:23
-
-
Save guyarad/995bdc915ef11ed8371901a46c0b3c5e to your computer and use it in GitHub Desktop.
PyCharm issuing wrong and annoying intellisense warnings (Python 2.7.14, PyCharm 2017.3.2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 2.7.14, PyCharm 2017.3.2 | |
from collections import defaultdict | |
some_default_dict = defaultdict(list) | |
some_default_dict[1] = 'a' | |
some_default_dict[2] = 'b' | |
some_objects = [{'id': i} for i in range(10)] | |
obj_by_id = {obj['id']: obj for obj in some_objects} | |
for key, value in some_default_dict.iteritems(): | |
# ^^^^^^^^^^^^^^^^^^^^^^^^^ PyCharm warning: Expected 'collections.Iterable', got 'Iterator[Tuple[Any, Any]]' instead | |
obj = obj_by_id.get(key) | |
# ^^^ PyCharm warning: Unresolved attribute reference 'get' for class 'dict' | |
some_default_dict.values() | |
# ^^^^^^ PyCharm warning: Unresolved attribute reference 'values' for class 'defaultdict' | |
def foo(**kwargs): | |
kwargs.pop('bla', None) | |
# ^^^ PyCharm warning: Unresolved attribute reference 'pop' for class 'dict' | |
def bar(**kwargs): | |
foo(**kwargs) | |
# ^^^^^^^^ PyCharm warning: Expected a dictionary, got dict | |
bar(a=1, b=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment