File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1012,17 +1012,22 @@ def initialize(self):
1012
1012
if not msg .may_be_emitted ():
1013
1013
self ._msgs_state [msg .msgid ] = False
1014
1014
1015
- def _discover_files (self , files_or_modules ):
1015
+ @staticmethod
1016
+ def _discover_files (files_or_modules : Sequence [str ]) -> Iterator [str ]:
1017
+ """Discover python modules and packages in subdirectory.
1018
+
1019
+ Returns iterator of paths to discovered modules and packages.
1020
+ """
1016
1021
for something in files_or_modules :
1017
1022
if os .path .isdir (something ) and not os .path .isfile (
1018
1023
os .path .join (something , "__init__.py" )
1019
1024
):
1020
1025
skip_subtrees = []
1021
- for root , dirs , files in os .walk (something ):
1026
+ for root , _ , files in os .walk (something ):
1022
1027
if any (root .startswith (s ) for s in skip_subtrees ):
1023
- # Skip subtree of already discovered package
1028
+ # Skip subtree of already discovered package.
1024
1029
continue
1025
- elif "__init__.py" in files :
1030
+ if "__init__.py" in files :
1026
1031
skip_subtrees .append (root )
1027
1032
yield root
1028
1033
else :
You can’t perform that action at this time.
0 commit comments