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

Function generateAstAssignableExpression

python/text_generator.py:119–131  ·  view source on GitHub ↗
(nodeList)

Source from the content-addressed store, hash-verified

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

Callers 2

generateForStatementFunction · 0.70

Calls 1

generateSubscriptFunction · 0.70

Tested by

no test coverage detected