def map_modules(obj, parent):
"""
Find and map all the modules recursively.
:param obj: Find all modules from the object.
:type obj: :class:`object`
:param parent: Parent node which you are searching in.
:type parent: :class:`ruruki.interfaces.IVertex`
"""
# get all the functions in the module
for _, obj in inspect.getmembers(obj, inspect.ismodule):
_id = id(obj) + id(parent)
if _id in SEEN:
continue
SEEN.add(_id)
node = GRAPH.get_or_create_vertex("module", name=obj.__name__)
node.set_property(abstract=inspect.isabstract(obj))
GRAPH.get_or_create_edge(parent, "imports", node)
map_filename(obj, node)
logging.debug(
"(%s)-[:imports]->(%s)",
parent.properties["name"],
obj.__name__
)
map_classes(obj, node)
map_functions(obj, node)
map_modules(obj, node)
评论列表
文章目录