Commit b69f1d1 1 parent f38ceb6 commit b69f1d1 Copy full SHA for b69f1d1
File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -158,20 +158,23 @@ def base(module):
158
158
return '.' .join ((best_name (),) + module .parent .parts )
159
159
160
160
161
+ def is_local (import_ ):
162
+ return import_ .name .startswith (best_name ())
163
+
164
+
161
165
def inferred_deps ():
162
166
"""
163
167
Infer deps from module imports.
164
168
"""
165
- names = [
166
- ( imp .relative_to (base (module )), module )
169
+ imps = (
170
+ types . SimpleNamespace ( name = imp .relative_to (base (module )), module = module )
167
171
for module in filter (is_python , source_files ())
168
172
for imp in imports .get_module_imports (module )
169
173
if not imp .standard ()
170
- and not imp .relative_to (base (module )).startswith (best_name ())
171
- ]
172
- for name , module in names :
174
+ )
175
+ for imp in itertools .filterfalse (is_local , imps ):
173
176
# TODO(#30): Handle resolution errors gracefully
174
- yield pypi .distribution_for (name ) + extra_for (module )
177
+ yield pypi .distribution_for (imp . name ) + extra_for (imp . module )
175
178
176
179
177
180
def combined_deps ():
You can’t perform that action at this time.
0 commit comments