| 1 |
# line 1 |
| 2 |
def wrap(foo=None): |
| 3 |
def wrapper(func): |
| 4 |
return func |
| 5 |
return wrapper |
| 6 |
|
| 7 |
# line 7 |
| 8 |
def replace(func): |
| 9 |
def insteadfunc(): |
| 10 |
print('hello') |
| 11 |
return insteadfunc |
| 12 |
|
| 13 |
# line 13 |
| 14 |
@wrap() |
| 15 |
@wrap(wrap) |
| 16 |
def wrapped(): |
| 17 |
pass |
| 18 |
|
| 19 |
# line 19 |
| 20 |
@replace |
| 21 |
def gone(): |
| 22 |
pass |
| 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) |
| 56 |
|
| 57 |
# line 57 |
| 58 |
def with_comment(): # hello |
| 59 |
world |
| 60 |
|
| 61 |
# line 61 |
| 62 |
multiline_sig = [ |
| 63 |
lambda x, \ |
| 64 |
y: x+y, |
| 65 |
None, |
| 66 |
] |
| 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 |
| 91 |
|
| 92 |
# line 92 |
| 93 |
def f(): |
| 94 |
class X: |
| 95 |
def g(): |
| 96 |
"doc" |
| 97 |
return 42 |
| 98 |
return X |
| 99 |
method_in_dynamic_class = f().g |
| 100 |
|
| 101 |
#line 101 |
| 102 |
def keyworded(*arg1, arg2=1): |
| 103 |
pass |
| 104 |
|
| 105 |
#line 105 |
| 106 |
def annotated(arg1: list): |
| 107 |
pass |
| 108 |
|
| 109 |
#line 109 |
| 110 |
def keyword_only_arg(*, arg): |
| 111 |
pass |
| 112 |
|
| 113 |
@wrap(lambda: None) |
| 114 |
def func114(): |
| 115 |
return 115 |
| 116 |
|
| 117 |
class ClassWithMethod: |
| 118 |
def method(self): |
| 119 |
pass |
| 120 |
|
| 121 |
from functools import wraps |
| 122 |
|
| 123 |
def decorator(func): |
| 124 |
@wraps(func) |
| 125 |
def fake(): |
| 126 |
return 42 |
| 127 |
return fake |
| 128 |
|
| 129 |
#line 129 |
| 130 |
@decorator |
| 131 |
def real(): |
| 132 |
return 20 |
| 133 |
|
| 134 |
#line 134 |
| 135 |
class cls135: |
| 136 |
def func136(): |
| 137 |
def func137(): |
| 138 |
never_reached1 |
| 139 |
never_reached2 |
| 140 |
|
| 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 |
| 248 |
def positional_only_arg(a, /): |
| 249 |
pass |
| 250 |
|
| 251 |
#line 251 |
| 252 |
def all_markers(a, b, /, c, d, *, e, f): |
| 253 |
pass |
| 254 |
|
| 255 |
# line 255 |
| 256 |
def all_markers_with_args_and_kwargs(a, b, /, c, d, *args, e, f, **kwargs): |
| 257 |
pass |
| 258 |
|
| 259 |
#line 259 |
| 260 |
def all_markers_with_defaults(a, b=1, /, c=2, d=3, *, e=4, f=5): |
| 261 |
pass |
| 262 |
|
| 263 |
# line 263 |
| 264 |
def deco_factory(**kwargs): |
| 265 |
def deco(f): |
| 266 |
@wraps(f) |
| 267 |
def wrapper(*a, **kwd): |
| 268 |
kwd.update(kwargs) |
| 269 |
return f(*a, **kwd) |
| 270 |
return wrapper |
| 271 |
return deco |
| 272 |
|
| 273 |
@deco_factory(foo=(1 + 2), bar=lambda: 1) |
| 274 |
def complex_decorated(foo=0, bar=lambda: 0): |
| 275 |
return foo + bar() |
| 276 |
|
| 277 |
# line 276 |
| 278 |
parenthesized_lambda = ( |
| 279 |
lambda: ()) |
| 280 |
parenthesized_lambda2 = [ |
| 281 |
lambda: ()][0] |
| 282 |
parenthesized_lambda3 = {0: |
| 283 |
lambda: ()}[0] |
| 284 |
|
| 285 |
# line 285 |
| 286 |
post_line_parenthesized_lambda1 = (lambda: () |
| 287 |
) |
| 288 |
|
| 289 |
# line 289 |
| 290 |
nested_lambda = ( |
| 291 |
lambda right: [].map( |
| 292 |
lambda length: ())) |
| 293 |
|
| 294 |
# line 294 |
| 295 |
if True: |
| 296 |
class cls296: |
| 297 |
def f(): |
| 298 |
pass |
| 299 |
else: |
| 300 |
class cls296: |
| 301 |
def g(): |
| 302 |
pass |
| 303 |
|
| 304 |
# line 304 |
| 305 |
if False: |
| 306 |
class cls310: |
| 307 |
def f(): |
| 308 |
pass |
| 309 |
else: |
| 310 |
class cls310: |
| 311 |
def g(): |
| 312 |
pass |
| 313 |
|
| 314 |
# line 314 |
| 315 |
class ClassWithCodeObject: |
| 316 |
import sys |
| 317 |
code = sys._getframe(0).f_code |
| 318 |
|
| 319 |
import enum |
| 320 |
|
| 321 |
# line 321 |
| 322 |
class enum322(enum.Enum): |
| 323 |
A = 'a' |
| 324 |
|
| 325 |
# line 325 |
| 326 |
class enum326(enum.IntEnum): |
| 327 |
A = 1 |
| 328 |
|
| 329 |
# line 329 |
| 330 |
class flag330(enum.Flag): |
| 331 |
A = 1 |
| 332 |
|
| 333 |
# line 333 |
| 334 |
class flag334(enum.IntFlag): |
| 335 |
A = 1 |
| 336 |
|
| 337 |
# line 337 |
| 338 |
simple_enum338 = enum.Enum('simple_enum338', 'A') |
| 339 |
simple_enum339 = enum.IntEnum('simple_enum339', 'A') |
| 340 |
simple_flag340 = enum.Flag('simple_flag340', 'A') |
| 341 |
simple_flag341 = enum.IntFlag('simple_flag341', 'A') |
| 342 |
|
| 343 |
import typing |
| 344 |
|
| 345 |
# line 345 |
| 346 |
class nt346(typing.NamedTuple): |
| 347 |
x: int |
| 348 |
y: int |
| 349 |
|
| 350 |
# line 350 |
| 351 |
nt351 = typing.NamedTuple('nt351', (('x', int), ('y', int))) |
| 352 |
|
| 353 |
# line 353 |
| 354 |
class td354(typing.TypedDict): |
| 355 |
x: int |
| 356 |
y: int |
| 357 |
|
| 358 |
# line 358 |
| 359 |
td359 = typing.TypedDict('td359', (('x', int), ('y', int))) |
| 360 |
|
| 361 |
import dataclasses |
| 362 |
|
| 363 |
# line 363 |
| 364 |
@dataclasses.dataclass |
| 365 |
class dc364: |
| 366 |
x: int |
| 367 |
y: int |
| 368 |
|
| 369 |
# line 369 |
| 370 |
dc370 = dataclasses.make_dataclass('dc370', (('x', int), ('y', int))) |
| 371 |
dc371 = dataclasses.make_dataclass('dc370', (('x', int), ('y', int)), module=__name__) |
| 372 |
|
| 373 |
import inspect |
| 374 |
import itertools |
| 375 |
|
| 376 |
# line 376 |
| 377 |
ge377 = ( |
| 378 |
inspect.currentframe() |
| 379 |
for i in itertools.count() |
| 380 |
) |
| 381 |
|
| 382 |
# line 382 |
| 383 |
def func383(): |
| 384 |
# line 384 |
| 385 |
ge385 = ( |
| 386 |
inspect.currentframe() |
| 387 |
for i in itertools.count() |
| 388 |
) |
| 389 |
return ge385 |
| 390 |
|
| 391 |
# line 391 |
| 392 |
@decorator |
| 393 |
# comment |
| 394 |
def func394(): |
| 395 |
return 395 |
| 396 |
|
| 397 |
# line 397 |
| 398 |
@decorator |
| 399 |
|
| 400 |
def func400(): |
| 401 |
return 401 |
| 402 |
|
| 403 |
pass # end of file |