(Python) Resolve FQNs for definitions
Assuming we have a set of definitions captured by ast-grep, the next step is to compute a fully qualified name (FQN) for each one.
For example, if our input file is utils/math_ops.py:
class A:
def foo(self):
pass
class B:
def bar(self):
pass
def fizz():
pass
We want to record:
utils.math_ops.Autils.math_ops.A.fooutils.math_ops.A.Butils.math_ops.A.B.barutils.math_ops.fizz
This will involve traversing the AST and building a stack of "scope names" to track nested contexts (e.g. module -> class -> function).
Edited by Jonathan Shobrook