1# line 1 2def wrap(foo=None): 3 def wrapper(func): 4 return func 5 return wrapper 6 7# line 7 8def replace(func): 9 def insteadfunc(): 10 print('hello') 11 return insteadfunc 12 13# line 13 14@wrap() 15@wrap(wrap) 16def wrapped(): 17 pass 18 19# line 19 20@replace 21def gone(): 22 pass 23 24# line 24 25oll = lambda m: m 26 27# line 27 28tll = lambda g: g and \ 29g and \ 30g 31 32# line 32 33tlli = lambda d: d and \ 34 d 35 36# line 36 37def onelinefunc(): pass 38 39# line 39 40def manyargs(arg1, arg2, 41arg3, arg4): pass 42 43# line 43 44def twolinefunc(m): return m and \ 45m 46 47# line 47 48a = [None, 49 lambda x: x, 50 None] 51 52# line 52 53def setfunc(func): 54 globals()["anonymous"] = func 55setfunc(lambda x, y: x*y) 56 57# line 57 58def with_comment(): # hello 59 world 60 61# line 61 62multiline_sig = [ 63 lambda x, \ 64 y: x+y, 65 None, 66 ] 67 68# line 68 69def func69(): 70 class cls70: 71 def func71(): 72 pass 73 return cls70 74extra74 = 74 75 76# line 76 77def func77(): pass 78(extra78, stuff78) = 'xy' 79extra79 = 'stop' 80 81# line 81 82class cls82: 83 def func83(): pass 84(extra84, stuff84) = 'xy' 85extra85 = 'stop' 86 87# line 87 88def func88(): 89 # comment 90 return 90 91 92# line 92 93def f(): 94 class X: 95 def g(): 96 "doc" 97 return 42 98 return X 99method_in_dynamic_class = f().g 100 101#line 101 102def keyworded(*arg1, arg2=1): 103 pass 104 105#line 105 106def annotated(arg1: list): 107 pass 108 109#line 109 110def keyword_only_arg(*, arg): 111 pass 112 113@wrap(lambda: None) 114def func114(): 115 return 115 116 117class ClassWithMethod: 118 def method(self): 119 pass 120 121from functools import wraps 122 123def decorator(func): 124 @wraps(func) 125 def fake(): 126 return 42 127 return fake 128 129#line 129 130@decorator 131def real(): 132 return 20 133 134#line 134 135class cls135: 136 def func136(): 137 def func137(): 138 never_reached1 139 never_reached2 140 141# line 141 142class cls142: 143 a = """ 144class cls149: 145 ... 146""" 147 148# line 148 149class cls149: 150 151 def func151(self): 152 pass 153 154''' 155class cls160: 156 pass 157''' 158 159# line 159 160class cls160: 161 162 def func162(self): 163 pass 164 165# line 165 166class cls166: 167 a = ''' 168 class cls175: 169 ... 170 ''' 171 172# line 172 173class cls173: 174 175 class cls175: 176 pass 177 178# line 178 179class cls179: 180 pass 181 182# line 182 183class cls183: 184 185 class cls185: 186 187 def func186(self): 188 pass 189 190def class_decorator(cls): 191 return cls 192 193# line 193 194@class_decorator 195@class_decorator 196class cls196: 197 198 @class_decorator 199 @class_decorator 200 class cls200: 201 pass 202 203class cls203: 204 class cls204: 205 class cls205: 206 pass 207 class cls207: 208 class cls205: 209 pass 210 211# line 211 212def func212(): 213 class cls213: 214 pass 215 return cls213 216 217# line 217 218class cls213: 219 def func219(self): 220 class cls220: 221 pass 222 return cls220 223 224# line 224 225async def func225(): 226 class cls226: 227 pass 228 return cls226 229 230# line 230 231class cls226: 232 async def func232(self): 233 class cls233: 234 pass 235 return cls233 236 237if True: 238 class cls238: 239 class cls239: 240 '''if clause cls239''' 241else: 242 class cls238: 243 class cls239: 244 '''else clause 239''' 245 pass 246 247#line 247 248def positional_only_arg(a, /): 249 pass 250 251#line 251 252def all_markers(a, b, /, c, d, *, e, f): 253 pass 254 255# line 255 256def all_markers_with_args_and_kwargs(a, b, /, c, d, *args, e, f, **kwargs): 257 pass 258 259#line 259 260def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5): 261 pass 262