inspect_fodder.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # line 1
  2. 'A module docstring.'
  3. import sys, inspect
  4. # line 5
  5. # line 7
  6. def spam(a, /, b, c, d=3, e=4, f=5, *g, **h):
  7. eggs(b + d, c + f)
  8. # line 11
  9. def eggs(x, y):
  10. "A docstring."
  11. global fr, st
  12. fr = inspect.currentframe()
  13. st = inspect.stack()
  14. p = x
  15. q = y / 0
  16. # line 20
  17. class StupidGit:
  18. """A longer,
  19. indented
  20. docstring."""
  21. # line 27
  22. def abuse(self, a, b, c):
  23. """Another
  24. \tdocstring
  25. containing
  26. \ttabs
  27. \t
  28. """
  29. self.argue(a, b, c)
  30. # line 40
  31. def argue(self, a, b, c):
  32. try:
  33. spam(a, b, c)
  34. except:
  35. self.ex = sys.exc_info()
  36. self.tr = inspect.trace()
  37. @property
  38. def contradiction(self):
  39. 'The automatic gainsaying.'
  40. pass
  41. # line 53
  42. class MalodorousPervert(StupidGit):
  43. def abuse(self, a, b, c):
  44. pass
  45. @property
  46. def contradiction(self):
  47. pass
  48. Tit = MalodorousPervert
  49. class ParrotDroppings:
  50. pass
  51. class FesteringGob(MalodorousPervert, ParrotDroppings):
  52. def abuse(self, a, b, c):
  53. pass
  54. @property
  55. def contradiction(self):
  56. pass
  57. async def lobbest(grenade):
  58. pass
  59. currentframe = inspect.currentframe()
  60. try:
  61. raise Exception()
  62. except:
  63. tb = sys.exc_info()[2]
  64. class Callable:
  65. def __call__(self, *args):
  66. return args
  67. def as_method_of(self, obj):
  68. from types import MethodType
  69. return MethodType(self, obj)
  70. custom_method = Callable().as_method_of(42)
  71. del Callable
  72. # line 95
  73. class WhichComments:
  74. # line 97
  75. # before f
  76. def f(self):
  77. # line 100
  78. # start f
  79. return 1
  80. # line 103
  81. # end f
  82. # line 105
  83. # after f
  84. # before asyncf - line 108
  85. async def asyncf(self):
  86. # start asyncf
  87. return 2
  88. # end asyncf
  89. # after asyncf - line 113
  90. # end of WhichComments - line 114
  91. # after WhichComments - line 115