| 1 |
def x(): |
| 2 |
return |
| 3 |
|
| 4 |
|
| 5 |
x() |
| 6 |
|
| 7 |
def array(first_param): |
| 8 |
|
| 9 |
first_param |
| 10 |
return list() |
| 11 |
|
| 12 |
|
| 13 |
array.first_param |
| 14 |
|
| 15 |
array.first_param. |
| 16 |
func = array |
| 17 |
|
| 18 |
func.first_param |
| 19 |
|
| 20 |
|
| 21 |
array() |
| 22 |
|
| 23 |
|
| 24 |
arr |
| 25 |
|
| 26 |
|
| 27 |
def inputs(param): |
| 28 |
return param |
| 29 |
|
| 30 |
|
| 31 |
inputs(list) |
| 32 |
|
| 33 |
def variable_middle(): |
| 34 |
var = 3 |
| 35 |
return var |
| 36 |
|
| 37 |
|
| 38 |
variable_middle() |
| 39 |
|
| 40 |
def variable_rename(param): |
| 41 |
var = param |
| 42 |
return var |
| 43 |
|
| 44 |
|
| 45 |
variable_rename(1) |
| 46 |
|
| 47 |
def multi_line_func(a, |
| 48 |
|
| 49 |
b): |
| 50 |
return b |
| 51 |
|
| 52 |
|
| 53 |
multi_line_func(1,'') |
| 54 |
|
| 55 |
def multi_line_call(b): |
| 56 |
return b |
| 57 |
|
| 58 |
|
| 59 |
multi_line_call( |
| 60 |
|
| 61 |
b=1) |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
def asdf(a): |
| 66 |
return a |
| 67 |
|
| 68 |
x = asdf(a=1, |
| 69 |
) |
| 70 |
|
| 71 |
x |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
def double_exe(param): |
| 77 |
return param |
| 78 |
|
| 79 |
|
| 80 |
variable_rename(double_exe)("") |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
variable_rename(list())(). |
| 85 |
|
| 86 |
variable_rename(1)(). |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
def recursion(a, b): |
| 92 |
if a: |
| 93 |
return b |
| 94 |
else: |
| 95 |
return recursion(a+".", b+1) |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
recursion("a", 1.0) |
| 100 |
|
| 101 |
def other(a): |
| 102 |
return recursion2(a) |
| 103 |
|
| 104 |
def recursion2(a): |
| 105 |
if random.choice([0, 1]): |
| 106 |
return other(a) |
| 107 |
else: |
| 108 |
if random.choice([0, 1]): |
| 109 |
return recursion2("") |
| 110 |
else: |
| 111 |
return a |
| 112 |
|
| 113 |
|
| 114 |
recursion2(1) |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
def a(): |
| 121 |
|
| 122 |
b() |
| 123 |
return b() |
| 124 |
|
| 125 |
def b(): |
| 126 |
return 1 |
| 127 |
|
| 128 |
|
| 129 |
a() |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
def func(a=1, b=''): |
| 136 |
return a, b |
| 137 |
|
| 138 |
exe = func(b=list, a=tuple) |
| 139 |
|
| 140 |
exe[0] |
| 141 |
|
| 142 |
|
| 143 |
exe[1] |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
func()[0] |
| 151 |
|
| 152 |
func()[1] |
| 153 |
|
| 154 |
func(1.0)[0] |
| 155 |
|
| 156 |
func(1.0)[1] |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
func(a=1.0)[0] |
| 161 |
|
| 162 |
func(a=1.0)[1] |
| 163 |
|
| 164 |
func(b=1.0)[0] |
| 165 |
|
| 166 |
func(b=1.0)[1] |
| 167 |
|
| 168 |
func(a=list, b=set)[0] |
| 169 |
|
| 170 |
func(a=list, b=set)[1] |
| 171 |
|
| 172 |
|
| 173 |
def func_default(a, b=1): |
| 174 |
return a, b |
| 175 |
|
| 176 |
|
| 177 |
def nested_default(**kwargs): |
| 178 |
return func_default(**kwargs) |
| 179 |
|
| 180 |
|
| 181 |
nested_default(a=1.0)[0] |
| 182 |
|
| 183 |
nested_default(a=1.0)[1] |
| 184 |
|
| 185 |
nested_default(a=1.0, b='')[1] |
| 186 |
|
| 187 |
|
| 188 |
def default_function(a=default): |
| 189 |
|
| 190 |
return a |
| 191 |
|
| 192 |
|
| 193 |
default_function() |
| 194 |
|
| 195 |
default = int() |
| 196 |
|
| 197 |
def default_function(a=default): |
| 198 |
|
| 199 |
return a |
| 200 |
|
| 201 |
|
| 202 |
default_function() |
| 203 |
|
| 204 |
def default(a=default): |
| 205 |
|
| 206 |
a |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
def a(): |
| 212 |
l = 3 |
| 213 |
def func_b(): |
| 214 |
l = '' |
| 215 |
|
| 216 |
l |
| 217 |
|
| 218 |
func_b |
| 219 |
|
| 220 |
l |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
def args_func(*args): |
| 227 |
|
| 228 |
return args |
| 229 |
|
| 230 |
exe = args_func(1, "") |
| 231 |
|
| 232 |
exe[0] |
| 233 |
|
| 234 |
exe[1] |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
args_func(*1)[0] |
| 239 |
|
| 240 |
|
| 241 |
args_func(*iter([1]))[0] |
| 242 |
|
| 243 |
|
| 244 |
e = args_func(*[1 if UNDEFINED else "", {}]) |
| 245 |
|
| 246 |
e[0] |
| 247 |
|
| 248 |
e[1] |
| 249 |
|
| 250 |
_list = [1,""] |
| 251 |
exe2 = args_func(_list)[0] |
| 252 |
|
| 253 |
|
| 254 |
exe2[1] |
| 255 |
|
| 256 |
exe3 = args_func([1,""])[0] |
| 257 |
|
| 258 |
|
| 259 |
exe3[1] |
| 260 |
|
| 261 |
def args_func(arg1, *args): |
| 262 |
return arg1, args |
| 263 |
|
| 264 |
exe = args_func(1, "", list) |
| 265 |
|
| 266 |
exe[0] |
| 267 |
|
| 268 |
exe[1] |
| 269 |
|
| 270 |
exe[1][1] |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
def simple(a): |
| 275 |
|
| 276 |
return a |
| 277 |
def xargs(*args): |
| 278 |
return simple(*args) |
| 279 |
|
| 280 |
xargs(1) |
| 281 |
xargs('') |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
def memoize(func): |
| 286 |
def wrapper(*args, **kwargs): |
| 287 |
return func(*args, **kwargs) |
| 288 |
return wrapper |
| 289 |
|
| 290 |
|
| 291 |
class Something(): |
| 292 |
@memoize |
| 293 |
def x(self, a, b=1): |
| 294 |
return a |
| 295 |
|
| 296 |
|
| 297 |
Something().x(1) |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
def kwargs_func(**kwargs): |
| 304 |
|
| 305 |
kwargs.keys |
| 306 |
|
| 307 |
return kwargs |
| 308 |
|
| 309 |
exe = kwargs_func(a=3,b=4.0) |
| 310 |
|
| 311 |
exe |
| 312 |
|
| 313 |
exe['a'] |
| 314 |
|
| 315 |
exe['b'] |
| 316 |
|
| 317 |
exe['c'] |
| 318 |
|
| 319 |
a = 'a' |
| 320 |
exe2 = kwargs_func(**{a:3, |
| 321 |
'b':4.0}) |
| 322 |
|
| 323 |
|
| 324 |
exe2['a'] |
| 325 |
|
| 326 |
exe2['b'] |
| 327 |
|
| 328 |
exe2['c'] |
| 329 |
|
| 330 |
exe3 = kwargs_func(**{k: v for k, v in [(a, 3), ('b', 4.0)]}) |
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
exe3['a'] |
| 336 |
|
| 337 |
|
| 338 |
exe3['b'] |
| 339 |
|
| 340 |
|
| 341 |
exe3['c'] |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
def func_without_call(*args, **kwargs): |
| 348 |
|
| 349 |
args |
| 350 |
|
| 351 |
kwargs |
| 352 |
|
| 353 |
def fu(a=1, b="", *args, **kwargs): |
| 354 |
return a, b, args, kwargs |
| 355 |
|
| 356 |
exe = fu(list, 1, "", c=set, d="") |
| 357 |
|
| 358 |
|
| 359 |
exe[0] |
| 360 |
|
| 361 |
exe[1] |
| 362 |
|
| 363 |
exe[2] |
| 364 |
|
| 365 |
exe[2][0] |
| 366 |
|
| 367 |
exe[3] |
| 368 |
|
| 369 |
exe[3]['c'] |
| 370 |
|
| 371 |
|
| 372 |
def kwargs_iteration(**kwargs): |
| 373 |
return kwargs |
| 374 |
|
| 375 |
for x in kwargs_iteration(d=3): |
| 376 |
|
| 377 |
{'d': 1.0, 'c': '1'}[x] |
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
def function_args(a, b, c): |
| 384 |
return b |
| 385 |
|
| 386 |
def nested_args(*args): |
| 387 |
return function_args(*args) |
| 388 |
|
| 389 |
def nested_args2(*args, **kwargs): |
| 390 |
return nested_args(*args) |
| 391 |
|
| 392 |
|
| 393 |
nested_args('', 1, 1.0, list) |
| 394 |
|
| 395 |
nested_args(''). |
| 396 |
|
| 397 |
|
| 398 |
nested_args2('', 1, 1.0) |
| 399 |
|
| 400 |
nested_args2(''). |
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
def nested_kw(**kwargs1): |
| 406 |
return function_args(**kwargs1) |
| 407 |
|
| 408 |
def nested_kw2(**kwargs2): |
| 409 |
return nested_kw(**kwargs2) |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
nested_kw(b=1, c=1.0, list) |
| 414 |
|
| 415 |
nested_kw(b=1) |
| 416 |
|
| 417 |
|
| 418 |
nested_kw(d=1.0, b=1, list) |
| 419 |
|
| 420 |
nested_kw(a=3.0, b=1) |
| 421 |
|
| 422 |
nested_kw(b=1, a=r"") |
| 423 |
|
| 424 |
nested_kw(1, ''). |
| 425 |
|
| 426 |
nested_kw(a=''). |
| 427 |
|
| 428 |
|
| 429 |
nested_kw2(b=1) |
| 430 |
|
| 431 |
nested_kw2(b=1, c=1.0) |
| 432 |
|
| 433 |
nested_kw2(c=1.0, b=1) |
| 434 |
|
| 435 |
nested_kw2(''). |
| 436 |
|
| 437 |
nested_kw2(a=''). |
| 438 |
|
| 439 |
nested_kw2('', b=1). |
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
def nested_both(*args, **kwargs): |
| 445 |
return function_args(*args, **kwargs) |
| 446 |
|
| 447 |
def nested_both2(*args, **kwargs): |
| 448 |
return nested_both(*args, **kwargs) |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
nested_both('', b=1, c=1.0, list) |
| 453 |
|
| 454 |
nested_both('', c=1.0, b=1, list) |
| 455 |
|
| 456 |
|
| 457 |
nested_both(''). |
| 458 |
|
| 459 |
|
| 460 |
nested_both2('', b=1, c=1.0) |
| 461 |
|
| 462 |
nested_both2('', c=1.0, b=1) |
| 463 |
|
| 464 |
nested_both2(''). |
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
def function_def(a, b, c): |
| 470 |
return a, b |
| 471 |
|
| 472 |
def nested_def(a, *args, **kwargs): |
| 473 |
return function_def(a, *args, **kwargs) |
| 474 |
|
| 475 |
def nested_def2(*args, **kwargs): |
| 476 |
return nested_def(*args, **kwargs) |
| 477 |
|
| 478 |
|
| 479 |
nested_def2('', 1, 1.0)[0] |
| 480 |
|
| 481 |
nested_def2('', b=1, c=1.0)[0] |
| 482 |
|
| 483 |
nested_def2('', c=1.0, b=1)[0] |
| 484 |
|
| 485 |
nested_def2('', 1, 1.0)[1] |
| 486 |
|
| 487 |
nested_def2('', b=1, c=1.0)[1] |
| 488 |
|
| 489 |
nested_def2('', c=1.0, b=1)[1] |
| 490 |
|
| 491 |
nested_def2('')[1]. |
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
def a(): pass |
| 497 |
|
| 498 |
a.__closure__ |