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

Function splootNodesFromPython

python/convert_ast.py:360–376  ·  view source on GitHub ↗
(codeString)

Source from the content-addressed store, hash-verified

358 return statementNode['childSets']['statement'][0]
359
360def splootNodesFromPython(codeString):
361 global lineno
362 lineno = 1
363 tree = ast.parse(codeString)
364
365 if len(tree.body) > 1:
366 statements = getBlockBodyFromStatements(tree.body)
367 return (statements, NodeCateogry.PythonStatement)
368
369 statement = tree.body[0]
370 if type(statement) == ast.Expr:
371 # Statement is a single expression - just return the list of tokens
372 tokens = generateExpressionTokens(statement.value, None)
373 return (tokens, NodeCateogry.PythonExpressionToken)
374
375 statementNode = generateSplootStatement(statement)
376 return ([statementNode['childSets']['statement'][0]], NodeCateogry.PythonStatementContents)

Callers 1

processExampleFunction · 0.90

Calls 3

generateExpressionTokensFunction · 0.85
generateSplootStatementFunction · 0.85

Tested by

no test coverage detected