File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1818#
1919####################################################################################################
2020
21- __all__ = [" expand_path" , " find" , " walk" ]
21+ __all__ = [' expand_path' , ' find' , ' walk' ]
2222
2323####################################################################################################
2424
25+ from typing import Iterator
26+
2527import os
2628from pathlib import Path
2729
@@ -39,13 +41,13 @@ def find(file_name, directories):
3941
4042####################################################################################################
4143
42- def expand_path (path ):
44+ def expand_path (path ) -> Path :
4345 _ = os .path .expandvars (path )
4446 return Path (_ ).expanduser ().absolute ()
4547
4648####################################################################################################
4749
48- def walk (path , followlinks = False ):
49- for root , _ , files in os .walk (path , followlinks = followlinks ):
50+ def walk (path : Path | str , followlinks : bool = False ) -> Iterator [ Path ] :
51+ for root , _ , files in Path ( path ) .walk (follow_symlinks = followlinks ):
5052 for filename in files :
5153 yield Path (root ).joinpath (filename )
You can’t perform that action at this time.
0 commit comments