rope
rope copied to clipboard
Comment marker to tell ImportOrganizer to keep unused imports
Background: #21
The signals import was removed because it wasn't used. I don't want it to be removed though, as the import has intentional side effects.
Removing unused import is an intentional behavior. rope can't know that you intend to use an import just for its side effect. ... It would also be reasonable if user can add a special comment markers (e.g.
# rope: keep-unused-import
) on imports lines to prevent rope from removing them during reorganization.
An example of what this might look like:
from mod_two import func_three # rope: keep-unused-import
or for multiline imports (alternative 1 - special comment only takes effect at the end):
from mod_one import (
func_one,
func_two,
) # rope: keep-unused-import
Or maybe we should do instead (alternative 2 - put it at the first line instead):
from mod_one import ( # rope: keep-unused-import
func_one,
func_two,
)
Additional acceptance criteria:
- [ ] documentation