Skip to content

Commit

Permalink
mark import as unused on exit stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 29, 2024
1 parent cd28215 commit cc1198f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/python/pyflyby/_autoimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,11 @@ def _NewScopeCtx(self, **kwargs):
try:
yield
finally:
logger.debug("throwing last scope from scopestack: %r", new_scopestack[-1])
for name, use_checker in new_scopestack[-1].items():
if use_checker and use_checker.used == False:
logger.debug("unused checker %r ", use_checker)
self.unused_imports.append((use_checker.lineno, use_checker.source))
assert self.scopestack is new_scopestack
self.scopestack = prev_scopestack

Expand Down

0 comments on commit cc1198f

Please sign in to comment.