(callExpr, tokens)
| 68 | return SplootNode("PY_ARG", {'argument': [kwarg_node]}) |
| 69 | |
| 70 | def appendCallToken(callExpr, tokens): |
| 71 | arguments = [SplootNode("PY_ARG", {'argument': [generateExpression(arg)]}) for arg in callExpr.args] |
| 72 | if len(arguments) == 0: |
| 73 | arguments = [SplootNode("PY_ARG", {'argument': []})] |
| 74 | |
| 75 | keywords = [generateKeywordArgument(kwarg) for kwarg in callExpr.keywords] |
| 76 | arguments.extend(keywords) |
| 77 | |
| 78 | if type(callExpr.func) == ast.Name: |
| 79 | name = callExpr.func.id |
| 80 | tokens.append(SplootNode('PYTHON_CALL_VARIABLE', {"arguments": arguments}, {"identifier": name})) |
| 81 | elif type(callExpr.func) == ast.Attribute: |
| 82 | attr = callExpr.func |
| 83 | obj = generateExpressionTokens(attr.value) |
| 84 | node = SplootNode('PYTHON_CALL_MEMBER', {'arguments': arguments, 'object': obj}, {'member': attr.attr}) |
| 85 | tokens.append(node) |
| 86 | else: |
| 87 | raise Exception(f'Unsupported Call function expression: {ast.dump(callExpr.func)}') |
| 88 | |
| 89 | def appendAttribute(attrExpr, tokens): |
| 90 | obj = generateExpressionTokens(attrExpr.value) |
no test coverage detected