@@ -124,15 +124,15 @@ def finalise(self) -> Dict[str, FoundModule]:
124
124
return result
125
125
126
126
127
- def pyfiles (root : Path ) -> Generator [str , None , None ]:
127
+ def pyfiles (root : Path ) -> Generator [Path , None , None ]:
128
128
if root .is_file ():
129
129
if root .suffix == ".py" :
130
- yield str ( root .absolute () )
130
+ yield root .absolute ()
131
131
else :
132
132
raise ValueError (f"{ root } is not a python file or directory" )
133
133
elif root .is_dir ():
134
134
for item in root .rglob ("*.py" ):
135
- yield str ( item .absolute () )
135
+ yield item .absolute ()
136
136
137
137
138
138
def find_imported_modules (
@@ -143,14 +143,14 @@ def find_imported_modules(
143
143
vis = _ImportVisitor (ignore_modules_function = ignore_modules_function )
144
144
for path in paths :
145
145
for filename in pyfiles (path ):
146
- if ignore_files_function (filename ):
146
+ if ignore_files_function (str ( filename ) ):
147
147
log .info ("ignoring: %s" , os .path .relpath (filename ))
148
148
continue
149
149
log .debug ("scanning: %s" , os .path .relpath (filename ))
150
150
with open (filename , encoding = "utf-8" ) as file_obj :
151
151
content = file_obj .read ()
152
- vis .set_location (filename )
153
- vis .visit (ast .parse (content , filename ))
152
+ vis .set_location (str ( filename ) )
153
+ vis .visit (ast .parse (content , str ( filename ) ))
154
154
return vis .finalise ()
155
155
156
156
0 commit comments