Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

consider_iterating_dictionary.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # pylint: disable=missing-docstring, expression-not-assigned, too-few-public-methods, no-member, import-error, no-self-use, line-too-long
  2. from unknown import Unknown
  3. class CustomClass(object):
  4. def keys(self):
  5. return []
  6. for key in Unknown().keys():
  7. pass
  8. for key in Unknown.keys():
  9. pass
  10. for key in dict.keys():
  11. pass
  12. for key in {}.values():
  13. pass
  14. for key in {}.key():
  15. pass
  16. for key in CustomClass().keys():
  17. pass
  18. [key for key in {}.keys()] # [consider-iterating-dictionary]
  19. (key for key in {}.keys()) # [consider-iterating-dictionary]
  20. {key for key in {}.keys()} # [consider-iterating-dictionary]
  21. {key: key for key in {}.keys()} # [consider-iterating-dictionary]
  22. COMP1 = [key for key in {}.keys()] # [consider-iterating-dictionary]
  23. COMP2 = (key for key in {}.keys()) # [consider-iterating-dictionary]
  24. COMP3 = {key for key in {}.keys()} # [consider-iterating-dictionary]
  25. COMP4 = {key: key for key in {}.keys()} # [consider-iterating-dictionary]
  26. for key in {}.keys(): # [consider-iterating-dictionary]
  27. pass
  28. # Issue #1247
  29. DICT = {'a': 1, 'b': 2}
  30. COMP1 = [k * 2 for k in DICT.keys()] + [k * 3 for k in DICT.keys()] # [consider-iterating-dictionary,consider-iterating-dictionary]
  31. COMP2, COMP3 = [k * 2 for k in DICT.keys()], [k * 3 for k in DICT.keys()] # [consider-iterating-dictionary,consider-iterating-dictionary]
  32. SOME_TUPLE = ([k * 2 for k in DICT.keys()], [k * 3 for k in DICT.keys()]) # [consider-iterating-dictionary,consider-iterating-dictionary]