You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently tidy-imports only optimizes global imports. How difficult would it be to also optimize "local" imports, i.e., imports within a function? Example:
detect that import sys is unused in foo and suggest to remove it
detect that import os is present both at global as well as local scope. I think here it's correct to remove the global import since the only usage is in a function where os is imported locally. But in general if there's a global import not covered by local imports everywhere we should remove the local import.
Can you estimate how much work this would be?
The text was updated successfully, but these errors were encountered:
ArvidJB
changed the title
Tidy local imports
Tidy local imports (PyInf#11558)
Dec 1, 2023
My feeling with the architecture of pyflyby is that it's going to be complex, and just estimating the work would need significant work to figure out what is needed.
I'll try to look into in over the next few weeks to see what I can do, and try to come up with a plan/estimate.
Currently tidy-imports only optimizes global imports. How difficult would it be to also optimize "local" imports, i.e., imports within a function? Example:
Here we should
import sys
is unused infoo
and suggest to remove itimport os
is present both at global as well as local scope. I think here it's correct to remove the global import since the only usage is in a function whereos
is imported locally. But in general if there's a global import not covered by local imports everywhere we should remove the local import.Can you estimate how much work this would be?
The text was updated successfully, but these errors were encountered: