E30not.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. # Okay
  2. class X:
  3. pass
  4. # Okay
  5. def foo():
  6. pass
  7. # Okay
  8. # -*- coding: utf-8 -*-
  9. class X:
  10. pass
  11. # Okay
  12. # -*- coding: utf-8 -*-
  13. def foo():
  14. pass
  15. # Okay
  16. class X:
  17. def a():
  18. pass
  19. # comment
  20. def b():
  21. pass
  22. # This is a
  23. # ... multi-line comment
  24. def c():
  25. pass
  26. # This is a
  27. # ... multi-line comment
  28. @some_decorator
  29. class Y:
  30. def a():
  31. pass
  32. # comment
  33. def b():
  34. pass
  35. @property
  36. def c():
  37. pass
  38. try:
  39. from nonexistent import Bar
  40. except ImportError:
  41. class Bar(object):
  42. """This is a Bar replacement"""
  43. def with_feature(f):
  44. """Some decorator"""
  45. wrapper = f
  46. if has_this_feature(f):
  47. def wrapper(*args):
  48. call_feature(args[0])
  49. return f(*args)
  50. return wrapper
  51. try:
  52. next
  53. except NameError:
  54. def next(iterator, default):
  55. for item in iterator:
  56. return item
  57. return default
  58. def a():
  59. pass
  60. class Foo():
  61. """Class Foo"""
  62. def b():
  63. pass
  64. # comment
  65. def c():
  66. pass
  67. # comment
  68. def d():
  69. pass
  70. # This is a
  71. # ... multi-line comment
  72. # And this one is
  73. # ... a second paragraph
  74. # ... which spans on 3 lines
  75. # Function `e` is below
  76. # NOTE: Hey this is a testcase
  77. def e():
  78. pass
  79. def a():
  80. print
  81. # comment
  82. print
  83. print
  84. # Comment 1
  85. # Comment 2
  86. # Comment 3
  87. def b():
  88. pass
  89. # Okay
  90. def foo():
  91. pass
  92. def bar():
  93. pass
  94. class Foo(object):
  95. pass
  96. class Bar(object):
  97. pass
  98. if __name__ == '__main__':
  99. foo()
  100. # Okay
  101. classification_errors = None
  102. # Okay
  103. defined_properly = True
  104. # Okay
  105. defaults = {}
  106. defaults.update({})
  107. # Okay
  108. def foo(x):
  109. classification = x
  110. definitely = not classification