I have the following script:
extras_require={"dev": dev_reqs}
x = 3
entry_points={
"console_scripts": ["main=smamesdemo.run.main:main"]
}
I want to retrieve the following part as python data, dict and list not Nodes.
entry_points={
"console_scripts": ["main=smamesdemo.run.main:main"]
}
I have tried the following, but I am not actually able to get the values with this:
import ast
class CustomNodeTransformer(ast.NodeTransformer):
def visit_Assign(self, node):
print(node.value.__dict__)
return node
with open("./setup.py") as f:
code = f.read()
node = ast.parse(code)
CustomNodeTransformer().visit(node)
{'keys': [<ast.Constant object at 0x0000029E992962C0>], 'values': [<ast.Name object at 0x0000029E99296260>], 'lineno': 1, 'col_offset': 15, 'end_lineno': 1, 'end_col_offset': 32}
Expected:
entry_points={"console_scripts": ["main=smamesdemo.run.main:main"]}
Can anyone help me to achieve this?