@@ -686,8 +686,8 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
686
686
# are not collected more than once.
687
687
matchnodes_cache : Dict [Tuple [Type [nodes .Collector ], str ], CollectReport ] = {}
688
688
689
- # Dirnames of pkgs with dunder-init files.
690
- pkg_roots : Dict [str , Package ] = {}
689
+ # Directories of pkgs with dunder-init files.
690
+ pkg_roots : Dict [Path , Package ] = {}
691
691
692
692
for argpath , names in self ._initial_parts :
693
693
self .trace ("processing argument" , (argpath , names ))
@@ -708,7 +708,7 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
708
708
col = self ._collectfile (pkginit , handle_dupes = False )
709
709
if col :
710
710
if isinstance (col [0 ], Package ):
711
- pkg_roots [str ( parent ) ] = col [0 ]
711
+ pkg_roots [parent ] = col [0 ]
712
712
node_cache1 [col [0 ].path ] = [col [0 ]]
713
713
714
714
# If it's a directory argument, recurse and look for any Subpackages.
@@ -717,7 +717,7 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
717
717
assert not names , f"invalid arg { (argpath , names )!r} "
718
718
719
719
seen_dirs : Set [Path ] = set ()
720
- for direntry in visit (str ( argpath ) , self ._recurse ):
720
+ for direntry in visit (argpath , self ._recurse ):
721
721
if not direntry .is_file ():
722
722
continue
723
723
@@ -732,8 +732,8 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
732
732
for x in self ._collectfile (pkginit ):
733
733
yield x
734
734
if isinstance (x , Package ):
735
- pkg_roots [str ( dirpath ) ] = x
736
- if str ( dirpath ) in pkg_roots :
735
+ pkg_roots [dirpath ] = x
736
+ if dirpath in pkg_roots :
737
737
# Do not collect packages here.
738
738
continue
739
739
@@ -750,7 +750,7 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
750
750
if argpath in node_cache1 :
751
751
col = node_cache1 [argpath ]
752
752
else :
753
- collect_root = pkg_roots .get (str ( argpath .parent ) , self )
753
+ collect_root = pkg_roots .get (argpath .parent , self )
754
754
col = collect_root ._collectfile (argpath , handle_dupes = False )
755
755
if col :
756
756
node_cache1 [argpath ] = col
0 commit comments