Function: python--list-imports
python--list-imports is a byte-compiled function defined in
python.el.gz.
Signature
(python--list-imports NAME SOURCE)
Documentation
List all Python imports matching NAME in SOURCE.
If NAME is nil, list all imports. SOURCE can be a buffer or a list of file names or directories; the latter are searched recursively.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python--list-imports (name source)
"List all Python imports matching NAME in SOURCE.
If NAME is nil, list all imports. SOURCE can be a buffer or a
list of file names or directories; the latter are searched
recursively."
(let ((buffer (current-buffer)))
(with-temp-buffer
(let* ((temp (current-buffer))
(status (if (bufferp source)
(with-current-buffer source
(apply #'call-process-region
(point-min) (point-max)
python-interpreter
nil (list temp nil) nil
(append
(split-string-shell-command
python-interpreter-args)
`("-c" ,python--list-imports)
(list (or name "")))))
(with-current-buffer buffer
(apply #'call-process
python-interpreter
nil (list temp nil) nil
(append
(split-string-shell-command
python-interpreter-args)
`("-c" ,python--list-imports)
(list (or name ""))
(mapcar #'file-local-name source))))))
lines)
(python--list-imports-check-status status)
(goto-char (point-min))
(while (not (eobp))
(push (buffer-substring-no-properties (point) (pos-eol))
lines)
(forward-line 1))
(nreverse lines)))))