MCPcopy
hub / github.com/rocky/python-uncompyle6 / format_pos_args

Function format_pos_args

uncompyle6/semantics/customize36.py:378–396  ·  view source on GitHub ↗

Positional args should format to: (*(2, ), ...) -> (2, ...) We remove starting and trailing parenthesis and ', ' if tuple has only one element.

(node)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

traverseMethod · 0.45

Tested by

no test coverage detected