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

Function build_param

uncompyle6/semantics/make_function1.py:38–54  ·  view source on GitHub ↗

build parameters: - handle defaults - handle format tuple parameters

(tree, param_names: List[str])

Source from the content-addressed store, hash-verified

36 """
37
38 def build_param(tree, param_names: List[str]) -> Tuple[bool, List[str]]:
39 """build parameters:
40 - handle defaults
41 - handle format tuple parameters
42 """
43 # if formal parameter is a tuple, the parameter name
44 # starts with a dot (eg. '.1', '.2')
45 args = tree[0]
46 del tree[0]
47 params = []
48 assert args.kind in ("star_args", "args", "varargs")
49 has_star_arg = args.kind in ("star_args", "varargs")
50 args_store = args[2]
51 if args_store == "args_store":
52 for arg in args_store:
53 params.append(param_names[arg.attr])
54 return has_star_arg, params
55
56 # MAKE_FUNCTION_... or MAKE_CLOSURE_...
57 assert node[-1].kind.startswith("BUILD_")

Callers 1

make_function1Function · 0.70

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected