Positional args should format to: (*(2, ), ...) -> (2, ...) We remove starting and trailing parenthesis and ', ' if tuple has only one element.
(node)
| 376 | self.n_call_ex_kw4 = call_ex_kw4 |
| 377 | |
| 378 | def format_pos_args(node): |
| 379 | """ |
| 380 | Positional args should format to: |
| 381 | (*(2, ), ...) -> (2, ...) |
| 382 | We remove starting and trailing parenthesis and ', ' if |
| 383 | tuple has only one element. |
| 384 | """ |
| 385 | value = self.traverse(node, indent="") |
| 386 | if value.startswith("("): |
| 387 | assert value.endswith(")") |
| 388 | value = value[1:-1].rstrip( |
| 389 | " " |
| 390 | ) # Remove starting '(' and trailing ')' and additional spaces |
| 391 | if value == "": |
| 392 | pass # args is empty |
| 393 | else: |
| 394 | if value.endswith(","): # if args has only one item |
| 395 | value = value[:-1] |
| 396 | return value |
| 397 | |
| 398 | self.format_pos_args = format_pos_args |
| 399 |