Function: python-remove-import
python-remove-import is an autoloaded, interactive and byte-compiled
function defined in python.el.gz.
Signature
(python-remove-import NAME)
Documentation
Remove an import statement from the current buffer.
Interactively, ask for an import statement to remove, displaying the imports of the current buffer as suggestions. With a prefix argument, restrict the suggestions to imports defining the symbol at point. If there is only one such suggestion, act without asking.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
;;;###autoload
(defun python-remove-import (name)
"Remove an import statement from the current buffer.
Interactively, ask for an import statement to remove, displaying
the imports of the current buffer as suggestions. With a prefix
argument, restrict the suggestions to imports defining the symbol
at point. If there is only one such suggestion, act without
asking."
(interactive (list (when current-prefix-arg (thing-at-point 'symbol))))
(when-let ((statement (python--query-import name (current-buffer)
"Remove import: ")))
(if (python--do-isort "--rm" statement)
(message "Removed `%s'" statement)
(message "(No changes in Python imports needed)"))))