Expand description
Convenience helpers for common code entities and relationships.
This module provides higher-level abstractions for working with code graphs, reducing boilerplate for common operations like adding files, functions, classes, and tracking relationships between them.
Structs§
- Function
Metadata - Metadata for a function with extended properties.
Functions§
- add_
call - Add a function call relationship with line metadata.
- add_
class - Add a class node and automatically link it to a file.
- add_
file - Add a file node to the graph.
- add_
function - Add a function node and automatically link it to a file.
- add_
function_ with_ metadata - Add a function node with extended metadata.
- add_
import - Add an import relationship with imported symbols.
- add_
method - Add a method node and link it to a class.
- add_
module - Add a module node to the graph.
- call_
chain - Find all call chains (paths) between two functions.
- circular_
deps - Detect circular dependencies in file imports.
- find_
file_ by_ path - Find a file node by its path.
- get_
callees - Get all functions called by the given function.
- get_
callers - Get all functions that call the given function.
- get_
file_ dependencies - Get all files that a file depends on (imports from).
- get_
file_ dependents - Get all files that depend on this file (import this file).
- get_
functions_ in_ file - Get all functions contained in a file.
- link_
to_ file - Create a generic Contains edge between two nodes.
- node_
ids_ to_ paths - Convert a slice of node IDs to their corresponding file paths.
- transitive_
dependencies - Find all transitive dependencies of a file (what it imports, directly or indirectly).
- transitive_
dependents - Find all transitive dependents of a file (what imports it, directly or indirectly).