(node)
| 335 | self.n_c_with = n_c_with |
| 336 | |
| 337 | def n_call(node): |
| 338 | p = self.prec |
| 339 | self.prec = 100 |
| 340 | mapping = self._get_mapping(node) |
| 341 | table = mapping[0] |
| 342 | key = node |
| 343 | for i in mapping[1:]: |
| 344 | key = key[i] |
| 345 | pass |
| 346 | opname = key.kind |
| 347 | if opname.startswith("CALL_FUNCTION_VAR_KW"): |
| 348 | # Python 3.5 changes the stack position of |
| 349 | # *args: kwargs come after *args whereas |
| 350 | # in earlier Pythons, *args is at the end |
| 351 | # which simplifies things from our |
| 352 | # perspective. Python 3.6+ replaces |
| 353 | # CALL_FUNCTION_VAR_KW with |
| 354 | # CALL_FUNCTION_EX We will just swap the |
| 355 | # order to make it look like earlier |
| 356 | # Python 3. |
| 357 | entry = table[key.kind] |
| 358 | kwarg_pos = entry[2][1] |
| 359 | args_pos = kwarg_pos - 1 |
| 360 | # Put last node[args_pos] after subsequent kwargs |
| 361 | while node[kwarg_pos] == "kwarg" and kwarg_pos < len(node): |
| 362 | # swap node[args_pos] with node[kwargs_pos] |
| 363 | node[kwarg_pos], node[args_pos] = node[args_pos], node[kwarg_pos] |
| 364 | args_pos = kwarg_pos |
| 365 | kwarg_pos += 1 |
| 366 | elif opname.startswith("CALL_FUNCTION_VAR"): |
| 367 | # CALL_FUNCTION_VAR's top element of the stack contains |
| 368 | # the variable argument list, then comes |
| 369 | # annotation args, then keyword args. |
| 370 | # In the most least-top-most stack entry, but position 1 |
| 371 | # in node order, the positional args. |
| 372 | argc = node[-1].attr |
| 373 | nargs = argc & 0xFF |
| 374 | kwargs = (argc >> 8) & 0xFF |
| 375 | # FIXME: handle annotation args |
| 376 | if nargs > 0: |
| 377 | template = ("%c(%P, ", 0, (1, nargs + 1, ", ", 100)) |
| 378 | else: |
| 379 | template = ("%c(", 0) |
| 380 | self.template_engine(template, node) |
| 381 | |
| 382 | args_node = node[-2] |
| 383 | if args_node in ("pos_arg", "expr"): |
| 384 | args_node = args_node[0] |
| 385 | if args_node == "build_list_unpack": |
| 386 | template = ("*%P)", (0, len(args_node) - 1, ", *", 100)) |
| 387 | self.template_engine(template, args_node) |
| 388 | else: |
| 389 | if len(node) - nargs > 3: |
| 390 | template = ( |
| 391 | "*%c, %P)", |
| 392 | nargs + 1, |
| 393 | (nargs + kwargs + 1, -1, ", ", 100), |
| 394 | ) |
nothing calls this directly
no test coverage detected