File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,13 @@ def __init__(self) -> None:
381381 # Set of fully-qualified imports like "utils.helpers.extract_path"
382382 self .imported_names : set [str ] = set ()
383383
384+ def get_full_name (self , expr : cst .BaseExpression ) -> str :
385+ if isinstance (expr , cst .Name ):
386+ return expr .value
387+ if isinstance (expr , cst .Attribute ):
388+ return f"{ self .get_full_name (expr .value )} .{ expr .attr .value } "
389+ return ""
390+
384391 def visit_ImportFrom (self , node : cst .ImportFrom ) -> None :
385392 # Get the full module path like "utils.helpers"
386393 module = ("." * node .relative if node .relative else "" ) + (
@@ -399,7 +406,7 @@ def visit_ImportFrom(self, node: cst.ImportFrom) -> None:
399406 def visit_Import (self , node : cst .Import ) -> None :
400407 for name in node .names :
401408 if isinstance (name , cst .ImportAlias ):
402- full_module_path = name . name .value # e.g., "utils.helpers"
409+ full_module_path = self . get_full_name ( name .name )
403410 self .imported_names .add (full_module_path )
404411
405412
You can’t perform that action at this time.
0 commit comments