MCPcopy Create free account
hub / github.com/SplootCode/splootcode / generateAstAssignableExpression

Function generateAstAssignableExpression

python/executor.py:124–136  ·  view source on GitHub ↗
(nodeList)

Source from the content-addressed store, hash-verified

122
123
124def generateAstAssignableExpression(nodeList):
125 targets = []
126 for node in nodeList:
127 if node["type"] == "PY_IDENTIFIER":
128 identifier = node["properties"]["identifier"]
129 targets.append(ast.Name(identifier, ctx=ast.Store()))
130 elif node["type"] == "PYTHON_SUBSCRIPT":
131 targets.append(generateSubscript(node, context=ast.Store()))
132 else:
133 raise Exception(f'Unrecognised assignable expression token: {node["type"]}')
134 if len(targets) > 1:
135 return ast.Tuple(targets, ast.Store())
136 return targets[0]
137
138
139def parseLeaf(tokens, currentIndex):

Callers 2

generateForStatementFunction · 0.70

Calls 1

generateSubscriptFunction · 0.70

Tested by

no test coverage detected