Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 1 | # line 1 |
| 2 | def wrap(foo=None): |
Tim Peters | 5a9fb3c | 2005-01-07 16:01:32 +0000 | [diff] [blame] | 3 | def wrapper(func): |
| 4 | return func |
| 5 | return wrapper |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 6 | |
| 7 | # line 7 |
| 8 | def replace(func): |
Tim Peters | 5a9fb3c | 2005-01-07 16:01:32 +0000 | [diff] [blame] | 9 | def insteadfunc(): |
Guido van Rossum | be19ed7 | 2007-02-09 05:37:30 +0000 | [diff] [blame] | 10 | print('hello') |
Tim Peters | 5a9fb3c | 2005-01-07 16:01:32 +0000 | [diff] [blame] | 11 | return insteadfunc |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 12 | |
| 13 | # line 13 |
| 14 | @wrap() |
| 15 | @wrap(wrap) |
| 16 | def wrapped(): |
Tim Peters | 5a9fb3c | 2005-01-07 16:01:32 +0000 | [diff] [blame] | 17 | pass |
Johannes Gijsbers | cb9015d | 2004-12-12 16:20:22 +0000 | [diff] [blame] | 18 | |
| 19 | # line 19 |
| 20 | @replace |
| 21 | def gone(): |
Tim Peters | 5a9fb3c | 2005-01-07 16:01:32 +0000 | [diff] [blame] | 22 | pass |
Johannes Gijsbers | 1542f34 | 2004-12-12 16:46:28 +0000 | [diff] [blame] | 23 | |
| 24 | # line 24 |
| 25 | oll = lambda m: m |
| 26 | |
| 27 | # line 27 |
| 28 | tll = lambda g: g and \ |
| 29 | g and \ |
| 30 | g |
| 31 | |
| 32 | # line 32 |
| 33 | tlli = lambda d: d and \ |
| 34 | d |
| 35 | |
| 36 | # line 36 |
| 37 | def onelinefunc(): pass |
| 38 | |
| 39 | # line 39 |
| 40 | def manyargs(arg1, arg2, |
| 41 | arg3, arg4): pass |
| 42 | |
| 43 | # line 43 |
| 44 | def twolinefunc(m): return m and \ |
| 45 | m |
| 46 | |
| 47 | # line 47 |
| 48 | a = [None, |
| 49 | lambda x: x, |
| 50 | None] |
| 51 | |
| 52 | # line 52 |
| 53 | def setfunc(func): |
| 54 | globals()["anonymous"] = func |
| 55 | setfunc(lambda x, y: x*y) |
Johannes Gijsbers | a5855d5 | 2005-03-12 16:37:11 +0000 | [diff] [blame] | 56 | |
| 57 | # line 57 |
| 58 | def with_comment(): # hello |
| 59 | world |
| 60 | |
| 61 | # line 61 |
| 62 | multiline_sig = [ |
Guido van Rossum | 1bc535d | 2007-05-15 18:46:22 +0000 | [diff] [blame] | 63 | lambda x, \ |
| 64 | y: x+y, |
Johannes Gijsbers | a5855d5 | 2005-03-12 16:37:11 +0000 | [diff] [blame] | 65 | None, |
| 66 | ] |
Armin Rigo | dd5c023 | 2005-09-25 11:45:45 +0000 | [diff] [blame] | 67 | |
| 68 | # line 68 |
| 69 | def func69(): |
| 70 | class cls70: |
| 71 | def func71(): |
| 72 | pass |
| 73 | return cls70 |
| 74 | extra74 = 74 |
| 75 | |
| 76 | # line 76 |
| 77 | def func77(): pass |
| 78 | (extra78, stuff78) = 'xy' |
| 79 | extra79 = 'stop' |
| 80 | |
| 81 | # line 81 |
| 82 | class cls82: |
| 83 | def func83(): pass |
| 84 | (extra84, stuff84) = 'xy' |
| 85 | extra85 = 'stop' |
| 86 | |
| 87 | # line 87 |
| 88 | def func88(): |
| 89 | # comment |
| 90 | return 90 |
Thomas Wouters | 00ee7ba | 2006-08-21 19:07:27 +0000 | [diff] [blame] | 91 | |
| 92 | # line 92 |
| 93 | def f(): |
| 94 | class X: |
| 95 | def g(): |
| 96 | "doc" |
| 97 | return 42 |
| 98 | return X |
Christian Heimes | 4a22b5d | 2007-11-25 09:39:14 +0000 | [diff] [blame] | 99 | method_in_dynamic_class = f().g |
Christian Heimes | 3795b53 | 2007-11-08 13:48:53 +0000 | [diff] [blame] | 100 | |
| 101 | #line 101 |
| 102 | def keyworded(*arg1, arg2=1): |
| 103 | pass |
| 104 | |
| 105 | #line 105 |
| 106 | def annotated(arg1: list): |
| 107 | pass |