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 |
Benjamin Peterson | 9953a8d | 2009-01-17 04:15:01 +0000 | [diff] [blame] | 108 | |
| 109 | #line 109 |
| 110 | def keyword_only_arg(*, arg): |
| 111 | pass |
Yury Selivanov | 081bbf6 | 2014-09-26 17:34:54 -0400 | [diff] [blame] | 112 | |
Antoine Pitrou | a8723a0 | 2015-04-15 00:41:29 +0200 | [diff] [blame] | 113 | @wrap(lambda: None) |
| 114 | def func114(): |
| 115 | return 115 |
| 116 | |
| 117 | class ClassWithMethod: |
| 118 | def method(self): |
| 119 | pass |
| 120 | |
Yury Selivanov | 081bbf6 | 2014-09-26 17:34:54 -0400 | [diff] [blame] | 121 | from functools import wraps |
| 122 | |
| 123 | def decorator(func): |
| 124 | @wraps(func) |
| 125 | def fake(): |
| 126 | return 42 |
| 127 | return fake |
| 128 | |
Antoine Pitrou | a8723a0 | 2015-04-15 00:41:29 +0200 | [diff] [blame] | 129 | #line 129 |
Yury Selivanov | 081bbf6 | 2014-09-26 17:34:54 -0400 | [diff] [blame] | 130 | @decorator |
| 131 | def real(): |
| 132 | return 20 |
Yury Selivanov | 4f4913b | 2015-07-23 17:10:00 +0300 | [diff] [blame] | 133 | |
| 134 | #line 134 |
| 135 | class cls135: |
| 136 | def func136(): |
| 137 | def func137(): |
| 138 | never_reached1 |
| 139 | never_reached2 |
Pablo Galindo | 8c77b8c | 2019-04-29 13:36:57 +0100 | [diff] [blame] | 140 | |
Karthikeyan Singaravelan | 696136b | 2020-04-18 21:49:32 +0530 | [diff] [blame] | 141 | # line 141 |
| 142 | class cls142: |
| 143 | a = """ |
| 144 | class cls149: |
| 145 | ... |
| 146 | """ |
| 147 | |
| 148 | # line 148 |
| 149 | class cls149: |
| 150 | |
| 151 | def func151(self): |
| 152 | pass |
| 153 | |
| 154 | ''' |
| 155 | class cls160: |
| 156 | pass |
| 157 | ''' |
| 158 | |
| 159 | # line 159 |
| 160 | class cls160: |
| 161 | |
| 162 | def func162(self): |
| 163 | pass |
| 164 | |
| 165 | # line 165 |
| 166 | class cls166: |
| 167 | a = ''' |
| 168 | class cls175: |
| 169 | ... |
| 170 | ''' |
| 171 | |
| 172 | # line 172 |
| 173 | class cls173: |
| 174 | |
| 175 | class cls175: |
| 176 | pass |
| 177 | |
| 178 | # line 178 |
| 179 | class cls179: |
| 180 | pass |
| 181 | |
| 182 | # line 182 |
| 183 | class cls183: |
| 184 | |
| 185 | class cls185: |
| 186 | |
| 187 | def func186(self): |
| 188 | pass |
| 189 | |
| 190 | def class_decorator(cls): |
| 191 | return cls |
| 192 | |
| 193 | # line 193 |
| 194 | @class_decorator |
| 195 | @class_decorator |
| 196 | class cls196: |
| 197 | |
| 198 | @class_decorator |
| 199 | @class_decorator |
| 200 | class cls200: |
| 201 | pass |
| 202 | |
| 203 | class cls203: |
| 204 | class cls204: |
| 205 | class cls205: |
| 206 | pass |
| 207 | class cls207: |
| 208 | class cls205: |
| 209 | pass |
| 210 | |
| 211 | # line 211 |
| 212 | def func212(): |
| 213 | class cls213: |
| 214 | pass |
| 215 | return cls213 |
| 216 | |
| 217 | # line 217 |
| 218 | class cls213: |
| 219 | def func219(self): |
| 220 | class cls220: |
| 221 | pass |
| 222 | return cls220 |
| 223 | |
| 224 | # line 224 |
| 225 | async def func225(): |
| 226 | class cls226: |
| 227 | pass |
| 228 | return cls226 |
| 229 | |
| 230 | # line 230 |
| 231 | class cls226: |
| 232 | async def func232(self): |
| 233 | class cls233: |
| 234 | pass |
| 235 | return cls233 |
| 236 | |
| 237 | if True: |
| 238 | class cls238: |
| 239 | class cls239: |
| 240 | '''if clause cls239''' |
| 241 | else: |
| 242 | class cls238: |
| 243 | class cls239: |
| 244 | '''else clause 239''' |
| 245 | pass |
| 246 | |
| 247 | #line 247 |
Pablo Galindo | 8c77b8c | 2019-04-29 13:36:57 +0100 | [diff] [blame] | 248 | def positional_only_arg(a, /): |
| 249 | pass |
| 250 | |
Karthikeyan Singaravelan | 696136b | 2020-04-18 21:49:32 +0530 | [diff] [blame] | 251 | #line 251 |
Pablo Galindo | 8c77b8c | 2019-04-29 13:36:57 +0100 | [diff] [blame] | 252 | def all_markers(a, b, /, c, d, *, e, f): |
| 253 | pass |
| 254 | |
Karthikeyan Singaravelan | 696136b | 2020-04-18 21:49:32 +0530 | [diff] [blame] | 255 | # line 255 |
Pablo Galindo | 8c77b8c | 2019-04-29 13:36:57 +0100 | [diff] [blame] | 256 | def all_markers_with_args_and_kwargs(a, b, /, c, d, *args, e, f, **kwargs): |
| 257 | pass |
| 258 | |
Karthikeyan Singaravelan | 696136b | 2020-04-18 21:49:32 +0530 | [diff] [blame] | 259 | #line 259 |
Pablo Galindo | 8c77b8c | 2019-04-29 13:36:57 +0100 | [diff] [blame] | 260 | def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5): |
| 261 | pass |