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.

func_bad_cont_dictcomp_py27.py 1003B

1234567891011121314151617181920212223242526272829303132333435363738
  1. """Bad continuations in dictionary comprehensions."""
  2. __revision__ = 0
  3. # Dictionary comprehensions should not require extra indentation when breaking
  4. # before the 'for', which is not part of the value
  5. C1 = {'key{}'.format(x): 'value{}'.format(x)
  6. for x in range(3)}
  7. C2 = {'key{}'.format(x): 'value{}'.format(x) for x in
  8. range(3)}
  9. # Dictionary comprehensions with multiple loops broken in different places
  10. C3 = {x*y: (x, y) for x in range(3) for y in range(3)}
  11. C4 = {x*y: (x, y)
  12. for x in range(3) for y in range(3)}
  13. C5 = {x*y: (x, y) for x
  14. in range(3) for y in range(3)}
  15. C6 = {x*y: (x, y) for x in range(3)
  16. for y in range(3)}
  17. C7 = {key:
  18. key ** 2
  19. for key in range(10)}
  20. C8 = {
  21. key: key ** 2
  22. for key in range(10)}
  23. # Misaligned cases for dict comprehensions
  24. C9 = {'key{}'.format(x): 'value{}'.format(x)
  25. for x in range(3)} # [bad-continuation]
  26. C9 = {'key{}'.format(x): 'value{}'.format(x)
  27. for x in range(3)} # [bad-continuation]