Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 1 | # line 1 |
| 2 | 'A module docstring.' |
| 3 | |
| 4 | import sys, inspect |
| 5 | # line 5 |
| 6 | |
| 7 | # line 7 |
Pablo Galindo | 8c77b8c | 2019-04-29 13:36:57 +0100 | [diff] [blame] | 8 | def spam(a, /, b, c, d=3, e=4, f=5, *g, **h): |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 9 | eggs(b + d, c + f) |
| 10 | |
| 11 | # line 11 |
| 12 | def eggs(x, y): |
| 13 | "A docstring." |
| 14 | global fr, st |
| 15 | fr = inspect.currentframe() |
| 16 | st = inspect.stack() |
| 17 | p = x |
| 18 | q = y / 0 |
| 19 | |
| 20 | # line 20 |
| 21 | class StupidGit: |
| 22 | """A longer, |
| 23 | |
| 24 | indented |
| 25 | |
| 26 | docstring.""" |
| 27 | # line 27 |
| 28 | |
| 29 | def abuse(self, a, b, c): |
| 30 | """Another |
| 31 | |
| 32 | \tdocstring |
| 33 | |
| 34 | containing |
| 35 | |
| 36 | \ttabs |
| 37 | \t |
| 38 | """ |
| 39 | self.argue(a, b, c) |
| 40 | # line 40 |
| 41 | def argue(self, a, b, c): |
| 42 | try: |
| 43 | spam(a, b, c) |
| 44 | except: |
| 45 | self.ex = sys.exc_info() |
| 46 | self.tr = inspect.trace() |
| 47 | |
Serhiy Storchaka | ac4bdcc | 2015-10-29 08:15:50 +0200 | [diff] [blame] | 48 | @property |
Serhiy Storchaka | 5cf2b72 | 2015-04-03 22:38:53 +0300 | [diff] [blame] | 49 | def contradiction(self): |
| 50 | 'The automatic gainsaying.' |
| 51 | pass |
| 52 | |
Serhiy Storchaka | ac4bdcc | 2015-10-29 08:15:50 +0200 | [diff] [blame] | 53 | # line 53 |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 54 | class MalodorousPervert(StupidGit): |
Serhiy Storchaka | 5cf2b72 | 2015-04-03 22:38:53 +0300 | [diff] [blame] | 55 | def abuse(self, a, b, c): |
| 56 | pass |
Serhiy Storchaka | ac4bdcc | 2015-10-29 08:15:50 +0200 | [diff] [blame] | 57 | |
| 58 | @property |
Serhiy Storchaka | 5cf2b72 | 2015-04-03 22:38:53 +0300 | [diff] [blame] | 59 | def contradiction(self): |
| 60 | pass |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 61 | |
Serhiy Storchaka | 362c1b5 | 2013-09-05 17:14:32 +0300 | [diff] [blame] | 62 | Tit = MalodorousPervert |
| 63 | |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 64 | class ParrotDroppings: |
| 65 | pass |
| 66 | |
| 67 | class FesteringGob(MalodorousPervert, ParrotDroppings): |
Serhiy Storchaka | 5cf2b72 | 2015-04-03 22:38:53 +0300 | [diff] [blame] | 68 | def abuse(self, a, b, c): |
| 69 | pass |
Serhiy Storchaka | ac4bdcc | 2015-10-29 08:15:50 +0200 | [diff] [blame] | 70 | |
| 71 | @property |
Serhiy Storchaka | 5cf2b72 | 2015-04-03 22:38:53 +0300 | [diff] [blame] | 72 | def contradiction(self): |
| 73 | pass |
Yury Selivanov | e4e811d | 2015-07-21 19:01:52 +0300 | [diff] [blame] | 74 | |
| 75 | async def lobbest(grenade): |
| 76 | pass |
Vladimir Matveev | 91cb298 | 2018-08-24 07:18:00 -0700 | [diff] [blame] | 77 | |
| 78 | currentframe = inspect.currentframe() |
| 79 | try: |
| 80 | raise Exception() |
| 81 | except: |
| 82 | tb = sys.exc_info()[2] |
Jeroen Demeyer | fcef60f | 2019-04-02 16:03:42 +0200 | [diff] [blame] | 83 | |
| 84 | class Callable: |
| 85 | def __call__(self, *args): |
| 86 | return args |
| 87 | |
| 88 | def as_method_of(self, obj): |
| 89 | from types import MethodType |
| 90 | return MethodType(self, obj) |
| 91 | |
| 92 | custom_method = Callable().as_method_of(42) |
| 93 | del Callable |