get_db_read function is actually calling but disappeared in 2.2.0
from fastapi import Depends
from database.depends import get_db_read
def get_id(db = Depends(get_db_read)):
return db.query(1).all()
def bug_depends_get_db_read():
"""
bug depends get_db_read
"""
file_name = os.path.join(os.path.dirname(__file__), "sample.py")
visitor = CallGraphVisitor([file_name])
visitor.process_one(file_name)
# traverse all children deep
edges = visitor.uses_edges
for start_node in edges:
descendants = set()
stack = [start_node]
while stack:
curr = stack.pop()
for child in edges.get(curr, set()):
if child not in descendants:
descendants.add(child)
stack.append(child)
for child in descendants:
print(f"{start_node.namespace}.{start_node.name} -> {child.namespace}.{child.name}")
.sample -> database.depends.get_db_read
.sample -> fastapi.Depends
sample.get_id -> database.depends.get_db_read -> disappeared
sample.get_id -> fastapi.Depends
sample.get_id -> fastapi.Depends.query
.sample -> database.depends.get_db_read
.sample -> fastapi.Depends
sample.get_id -> fastapi.Depends.query
get_db_read function is actually calling but disappeared in 2.2.0