How to find class parent and subclasses across different modules without running the code (static analysis)
Module Contains __init__.py and 4 files as below
Example first_file.py
class Parent(object):
def __init__(self):
pass
def method1(self):
print('parent')
Example second_file.py
from first_file import Parent
class Child(Parent):
def __init__(self):
pass
def method1(self):
print('child')
Example third_file.py
from first_file import Parent
class Child1(Parent):
def __init__(self):
pass
def method1(self):
print('child1')
Example fourth_file.py
from second_file import Child
class Child2(Child):
def __init__(self):
pass
def method1(self):
print('child2')
I want the way to list down the subclasses of parent given filename and class example
>>> findclasshierchay first_file.py --class Parent
and it will list down all subclasses with filenames