2
2
import sys
3
3
from functools import lru_cache
4
4
from pathlib import Path
5
- from typing import Iterable , Callable , Optional , Tuple , List , Set
5
+ from typing import Callable , Iterable , List , Optional , Set , Tuple
6
6
7
7
import networkx as nx
8
-
9
8
from dependency_graph .models import PathLike , VirtualPath
10
- from dependency_graph .models .graph_data import Node , Edge , EdgeRelation , NodeType
9
+ from dependency_graph .models .graph_data import Edge , EdgeRelation , Node , NodeType
11
10
from dependency_graph .models .language import Language
12
11
from dependency_graph .utils .digraph import lexicographical_cyclic_topological_sort
13
12
from dependency_graph .utils .intervals import find_innermost_interval
@@ -236,6 +235,7 @@ def get_related_edges_by_innermost_node_between_line(
236
235
start_line : int ,
237
236
* relations : EdgeRelation ,
238
237
) -> Optional [List [Tuple [Node , Node , Edge ]]]:
238
+ file_path = self ._Path (file_path )
239
239
node = self ._get_innermost_node_by_line (file_path , start_line )
240
240
related_edge_list = self .graph .get_related_edges_by_node (
241
241
node ,
@@ -270,6 +270,7 @@ def get_cross_file_context(
270
270
- The in node should be located in the repo and be cross-file
271
271
- The out node should be in the same file
272
272
"""
273
+ file_path = self ._Path (file_path )
273
274
# Don't feel guilty, self.graph.get_edges is cached!
274
275
edge_list = self .graph .get_edges (
275
276
edge_filter = lambda in_node , out_node , edge : self .is_node_from_cross_file (
@@ -296,6 +297,7 @@ def get_cross_file_definition_by_line(
296
297
It will return the cross-file definition of the innermost scope(func/class) located between the start_line.
297
298
Usually it is the out-node we are interested in.
298
299
"""
300
+ file_path = self ._Path (file_path )
299
301
edge_list = []
300
302
301
303
related_edge_list = self .get_related_edges_by_innermost_node_between_line (
@@ -360,6 +362,7 @@ def get_cross_file_reference_by_line(
360
362
It will return the cross-file usage of the innermost scope(func/class) located between the start_line.
361
363
Usually it is the out-node we are interested in.
362
364
"""
365
+ file_path = self ._Path (file_path )
363
366
related_edge_list = self .get_related_edges_by_innermost_node_between_line (
364
367
file_path ,
365
368
start_line ,
@@ -392,6 +395,7 @@ def get_related_edges_by_file(
392
395
"""
393
396
Get all related edges of a file and return them
394
397
"""
398
+ file_path = self ._Path (file_path )
395
399
return self .graph .get_edges (
396
400
edge_filter = lambda in_node , out_node , edge : self .is_node_from_in_file (
397
401
in_node , file_path
0 commit comments