Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
246 stars 59 forks source link

Python: how to handle imports #1535

Open maximiliankaul opened 1 month ago

maximiliankaul commented 1 month ago

How should we handle imports in Python? The current approach (VariableDeclaration without fqn) is not satisfactory and should be improved. What is the correct way to model this in the CPG?

@KuechA re-started this discussion.

oxisto commented 1 month ago

Probably similar as I do it in Go, but the whole system probably needs to be overhauled. Also slightly related to #1533

import * from X is basically the same as using namespace X in C++ import aliases also handled in Go with the aliases property in the scope manager, but this is a rather ugly hack

oxisto commented 3 weeks ago

We can start working on this, once #1536 is merged.