naiquevin / sphinx-doc.el Goto Github PK
View Code? Open in Web Editor NEWGenerate Sphinx friendly docstrings for Python functions in Emacs
Generate Sphinx friendly docstrings for Python functions in Emacs
Hi,
would it be possible to have the option of including the :type field during expansion of docstring?
As the title says: If type hints are used, sphinx-doc does not work anymore
E.g
def sum(a:int, b:int):
return a+b
Would you mind revising for a newer dash? Currently dash is on 2.16.1. Whenever I want to use sphinx doc, I get error because it requires 2.10.0
It seems function annotations are not supported (https://www.python.org/dev/peps/pep-3107/) as M-x sphinx-doc
does not work on the following code:
def get(self) -> dict:
raise HTTPMethodNotAllowed()
These are valid Sphinx fields and may be added by the user later so it makes sense to retain them when a docstring is updated even though they were not added initially
Before:
def helloworld():
pass
after:
def helloworld():
"""TODO describe function
:returns:
"""
pass
Instead, for an empty function can we remove returns:
value and we have more compact as follows:
def helloworld():
"""TODO describe function."""
pass
When I apply C-c M-d
it creates the doc section having new line at the end. Would it be possible to ignore the newline that applid at the end of docs?
Example output:
"""TODO describe function
:param provider:
:param _from:
:param job:
:returns:
"""
Wanted:
"""TODO describe function
:param provider:
:param _from:
:param job:
:returns:
"""
Are you thinking on support this style?
http://www.sphinx-doc.org/en/stable/ext/napoleon.html#napoleon-marching-toward-legible-docstrings
Thanks!
Hi !
I have discovered the existence of https://github.com/robodair/pydocstring.
Instead of re-invented the wheel, I think it could be worth replacing the current sphinx-doc
backend by the pydocstring
one.
What do you think @naiquevin ?
I can make a proof of concept draft PR if necessary.
In some codebases I have seen that trailing commas are used in function definitions, especially when functions take a lot of keyword parameters and people frequently change or add them. Trailing commas then help with version control and guard against forgotten commas. You might argue whether this is good stile, but the following is valid python:
def foo(arg1, arg2, arg3,):
return bar
sphinx-doc
then fails, because sphinx-doc-fun-args
creates an empy string ""
as the last arg. I fixed that in place by just removing empty strings from the argument list with remove ""
. But maybe there is a better place to implement a fix. I didn't go really went into understanding your code, so I refrained from a PR.
(defun sphinx-doc-fun-args (argstrs)
"Extract list of arg objects from string ARGSTRS.
ARGSTRS is the string representing function definition in Python.
Note that the arguments self, *args and **kwargs are ignored."
(when (not (string= argstrs ""))
(mapcar #'sphinx-doc-str->arg
(-filter
(lambda (str)
(and (not (string= (substring str 0 1) "*"))
(not (string= str "self"))))
(remove ""
(mapcar #'s-trim
(split-string argstrs ",")))))))
I am using emacs 30.0.50, each time a python file is opened i have to activate manually python-mode multiple times.
I can't use sphinx-doc anymore :(
My .emacs.d/init.el
(use-package sphinx-doc
:straight t
:hook (python-mode sphinx-doc)
:config (add-hook 'python-mode-hook (lambda ()
(require 'sphinx-doc)
(sphinx-doc-mode t)))
:after python
)
The error message:
Debugger entered--Lisp error: (search-failed "def")
search-backward-regexp("def")
(if (string= (thing-at-point 'word) "def") (back-to-indentation) (search-backward-regexp sphinx-doc-fun-beg-regex))
sphinx-doc()
run-hooks(change-major-mode-after-body-hook prog-mode-hook python-base-mode-hook python-mode-hook)
apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook python-base-mode-hook python-mode-hook))
run-mode-hooks(python-mode-hook)
python-mode()
set-auto-mode-0(python-mode nil)
set-auto-mode--apply-alist((("\\(?:\\(?:\\.\\(?:b\\(?:\\(?:abel\\|ower\\)rc\\)\\|json\\(?:ld\\)?\\)\\|composer\\.lock\\)\\'\\)" . json-mode) ("^yang\\.settings$" . jsonc-mode) ("\\.md\\'" . markdown-mode) ("\\.js$" . js2-mode) ("\\.envrc\\'" . direnv-envrc-mode) ("\\.[Jj]ust\\(file\\)?\\'" . just-mode) ("/[Jj]ustfile\\'" . just-mode) ("\\.lua\\'" . lua-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode) ("Dockerfile\\'" . dockerfile-mode) ("\\.dockerfile\\'" . dockerfile-mode) ("[/\\]\\(?:Containerfile\\|Dockerfile\\)\\(?:\\.[^/\\]*\\)?\\'" . dockerfile-mode) ("/git-rebase-todo\\'" . git-rebase-mode) ("\\.css\\'" . rainbow-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("/Jenkinsfile\\'" . groovy-mode) ("\\.g\\(?:ant\\|roovy\\|radle\\)\\'" . groovy-mode) ("\\.j2\\'" . jinja2-mode) ("\\.jinja2\\'" . jinja2-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'" . ruby-mode) ("\\.re?st\\'" . rst-mode) ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . conf-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ...) nil nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer file.py> "~/file.py" nil nil "~/file.py" (13013303 64513))
find-file-noselect("/home/user/file.py" nil nil nil)
find-file("/home/user/file.py")
(cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate)))
(let ((dir (and (not url-p) (helm-basedir candidate)))) (cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate))))
(if (cdr marked) (if (equal helm-current-prefix-arg '(16)) (mapc 'find-file-noselect marked) (helm-window-show-buffers (mapcar 'find-file-noselect marked))) (let ((dir (and (not url-p) (helm-basedir candidate)))) (cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate)))))
(let ((marked (helm-marked-candidates :with-wildcard t)) (url-p (and helm--url-regexp (string-match helm--url-regexp candidate))) (ffap-newfile-prompt helm-ff-newfile-prompt-p) (find-file-wildcards nil) (helm--reading-passwd-or-string t)) (if (cdr marked) (if (equal helm-current-prefix-arg '(16)) (mapc 'find-file-noselect marked) (helm-window-show-buffers (mapcar 'find-file-noselect marked))) (let ((dir (and (not url-p) (helm-basedir candidate)))) (cond ((and dir (file-directory-p dir)) (find-file (substitute-in-file-name candidate))) (url-p (find-file-at-point candidate)) ((and (not (file-exists-p candidate)) (string-match "/$" candidate)) (helm-ff--mkdir candidate 'helm-ff)) (dir (helm-ff--mkdir dir) (find-file candidate)) (t (find-file candidate))))))
helm-find-file-or-marked("/home/user/file.py")
funcall(helm-find-file-or-marked "/home/user/file.py")
(progn (funcall action selection))
(if (and selection action) (progn (funcall action selection)))
(let ((source (or helm-saved-current-source (helm-get-current-source))) non-essential) (setq selection (helm-coerce-selection (or selection helm-saved-selection (helm-get-selection nil nil source) (and (assq 'accept-empty source) "")) source)) (if preserve-saved-action nil (setq helm-saved-action nil)) (if (and selection action) (progn (funcall action selection))))
helm-execute-selection-action-1()
(prog1 (helm-execute-selection-action-1) (helm-log-run-hook "helm-execute-selection-action" 'helm-after-action-hook))
(unwind-protect (prog1 (helm-execute-selection-action-1) (helm-log-run-hook "helm-execute-selection-action" 'helm-after-action-hook)) (setq helm--executing-helm-action nil))
helm-execute-selection-action()
(if helm--quit nil (helm-execute-selection-action))
(prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))
(let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested (minibufferp helm-current-buffer)) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins (selected-window) (+ (string-width helm-visible-mark-prefix) helm-left-margin-width))))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45)))))
(condition-case _v (let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested (minibufferp helm-current-buffer)) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins (selected-window) (+ (string-width helm-visible-mark-prefix) helm-left-margin-width))))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))) ((debug quit) (helm-restore-position-on-quit) (helm-log-run-hook "helm-internal" 'helm-quit-hook) (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 45))) nil))
(unwind-protect (condition-case _v (let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested (minibufferp helm-current-buffer)) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins (selected-window) (+ ... helm-left-margin-width))))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))) ((debug quit) (helm-restore-position-on-quit) (helm-log-run-hook "helm-internal" 'helm-quit-hook) (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 45))) nil)) (if (fboundp 'advice-remove) (progn (advice-remove 'tramp-read-passwd #'helm--suspend-read-passwd) (advice-remove 'ange-ftp-get-passwd #'helm--suspend-read-passwd) (advice-remove 'epa-passphrase-callback-function #'helm--suspend-read-passwd) (advice-remove 'linum-on #'helm--advice-linum-on))) (helm-log "helm-internal" "helm-alive-p = %S" (setq helm-alive-p nil)) (helm--remap-mouse-mode -1) (setq helm-alive-p nil) (and ori--minibuffer-follows-selected-frame (set-default-toplevel-value 'minibuffer-follows-selected-frame ori--minibuffer-follows-selected-frame)) (setq helm--force-updating-p nil) (setq helm--buffer-in-new-frame-p nil) (setq helm-pattern "") (progn (setq helm--ignore-errors nil) (setq helm-debug nil)))
(let ((non-essential t) mouse-autoselect-window focus-follows-mouse mode-line-in-non-selected-windows minibuffer-completion-confirm (ori--minibuffer-follows-selected-frame (and (boundp 'minibuffer-follows-selected-frame) (default-toplevel-value 'minibuffer-follows-selected-frame))) (input-method-verbose-flag helm-input-method-verbose-flag) (helm-maybe-use-default-as-input (and (null input) (or helm-maybe-use-default-as-input (let* ((--cl-var-- ...) (s nil) (--cl-flag-- t) --cl-var--) (while (and ... ...) (setq --cl-var-- ...)) --cl-var--))))) (unwind-protect (condition-case _v (let (helm--source-name helm-current-source helm-in-persistent-action helm--quit (helm-buffer (or buffer helm-buffer))) (helm-initialize resume input default sources) (and ori--minibuffer-follows-selected-frame (setq minibuffer-follows-selected-frame (if (or helm--nested ...) nil t))) (if helm-execute-action-at-once-if-one nil (helm-display-buffer helm-buffer resume) (select-window (helm-window)) (if (and resume helm-visible-mark-overlays) (progn (set-window-margins ... ...)))) (if helm-allow-mouse nil (helm--remap-mouse-mode 1)) (add-hook 'post-command-hook 'helm--maybe-update-keymap) (add-hook 'helm-after-update-hook 'helm--maybe-update-keymap) (add-hook 'post-command-hook 'helm--update-header-line) (helm-log "helm-internal" "show prompt") (unwind-protect (helm-read-from-minibuffer prompt input preselect resume keymap default history) (helm-cleanup)) (prog1 (if helm--quit nil (helm-execute-selection-action)) (helm-log "helm-internal" (concat "[End session] " (make-string 41 45))))) ((debug quit) (helm-restore-position-on-quit) (helm-log-run-hook "helm-internal" 'helm-quit-hook) (helm-log "helm-internal" (concat "[End session (quit)] " (make-string 34 45))) nil)) (if (fboundp 'advice-remove) (progn (advice-remove 'tramp-read-passwd #'helm--suspend-read-passwd) (advice-remove 'ange-ftp-get-passwd #'helm--suspend-read-passwd) (advice-remove 'epa-passphrase-callback-function #'helm--suspend-read-passwd) (advice-remove 'linum-on #'helm--advice-linum-on))) (helm-log "helm-internal" "helm-alive-p = %S" (setq helm-alive-p nil)) (helm--remap-mouse-mode -1) (setq helm-alive-p nil) (and ori--minibuffer-follows-selected-frame (set-default-toplevel-value 'minibuffer-follows-selected-frame ori--minibuffer-follows-selected-frame)) (setq helm--force-updating-p nil) (setq helm--buffer-in-new-frame-p nil) (setq helm-pattern "") (progn (setq helm--ignore-errors nil) (setq helm-debug nil))))
helm-internal((helm-source-find-files helm-find-files-dummy-source) "/home/user/" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil)
apply(helm-internal ((helm-source-find-files helm-find-files-dummy-source) "/home/user/TODO" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil))
(if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist))
(if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist)))
(let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest)) (and helm-alive-p (memq ... plist))) #'helm--nest) ((keywordp (car plist)) #'helm) (t #'helm-internal)))) (if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda ... ...) helm-argument-keys))) (apply fn plist))))
helm((helm-source-find-files helm-find-files-dummy-source) "/home/user" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil)
apply(helm ((helm-source-find-files helm-find-files-dummy-source) "/home/user" "Find files or url: " nil "^[[:multibyte:] ]*cli2\\.py" "*helm find files*" nil "/home/user/TODO" nil))
(progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys)))
(if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist))
(if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda (key) (plist-get plist key)) helm-argument-keys))) (apply fn plist)))
(let ((fn (cond ((or (and helm-alive-p (plist-get plist :allow-nest)) (and helm-alive-p (memq ... plist))) #'helm--nest) ((keywordp (car plist)) #'helm) (t #'helm-internal)))) (if (and helm-alive-p (eq fn #'helm)) (if (helm--alive-p) (error "Error: Trying to run helm within a running helm session") (save-current-buffer (set-buffer (helm-buffer-get)) (prog1 (message "Aborting an helm session running in background") (helm-keyboard-quit)))) (if (keywordp (car plist)) (progn (setq helm--local-variables (append helm--local-variables (helm-parse-keys plist))) (apply fn (mapcar #'(lambda ... ...) helm-argument-keys))) (apply fn plist))))
helm(:sources (helm-source-find-files helm-find-files-dummy-source) :input "/home/user/" :case-fold-search smart :preselect "^[[:multibyte:] ]*cli2\\.py" :ff-transformer-show-only-basename t :dim-prompt-on-update t :default "/home/user/TODO" :prompt "Find files or url: " :buffer "*helm find files*")
(unwind-protect (helm :sources '(helm-source-find-files helm-find-files-dummy-source) :input fname :case-fold-search helm-file-name-case-fold-search :preselect preselect :ff-transformer-show-only-basename helm-ff-transformer-show-only-basename :dim-prompt-on-update helm-ff-dim-prompt-on-update :default def :prompt "Find files or url: " :buffer "*helm find files*") (helm-ff--update-resume-after-hook nil t) (setq helm-ff-default-directory nil))
(let* ((helm-ff-auto-update-initial-value (and helm-ff-auto-update-initial-value (not (minibuffer-window-active-p (minibuffer-window))))) (tap (thing-at-point 'filename)) (def (and tap (or (file-remote-p tap) (expand-file-name tap)))) (password-cache t)) (helm-set-local-variable 'helm-follow-mode-persistent nil 'helm-drag-mouse-1-fn 'helm-ff-drag-mouse-1-fn) (if helm-source-find-files nil (setq helm-source-find-files (helm-make-source "Find Files" 'helm-source-ffiles))) (if (helm-get-attr 'follow helm-source-find-files) (progn (helm-set-attr 'follow -1 helm-source-find-files))) (let ((it (and preselect (not helm-ff-preselect-ignore-large-dirs) (gethash fname helm-ff--directory-files-length helm-ff-candidate-number-limit)))) (if it (helm-set-attr 'candidate-number-limit (max it helm-ff-candidate-number-limit) helm-source-find-files))) (helm-ff-setup-update-hook) (add-hook 'helm-resume-after-hook 'helm-ff--update-resume-after-hook) (unwind-protect (helm :sources '(helm-source-find-files helm-find-files-dummy-source) :input fname :case-fold-search helm-file-name-case-fold-search :preselect preselect :ff-transformer-show-only-basename helm-ff-transformer-show-only-basename :dim-prompt-on-update helm-ff-dim-prompt-on-update :default def :prompt "Find files or url: " :buffer "*helm find files*") (helm-ff--update-resume-after-hook nil t) (setq helm-ff-default-directory nil)))
helm-find-files-1("/home/user/" "^[[:multibyte:] ]*cli2\\.py")
(let ((helm--executing-helm-action (not (null hist)))) (helm-find-files-1 input (and presel (null helm-ff-no-preselect) (format helm-ff-last-expanded-candidate-regexp (regexp-quote presel)))))
(let* (tramp-archive-enabled (hist (and arg helm-ff-history (helm-find-files-history nil))) (smart-input (or hist (helm-find-files-initial-input))) (default-input (expand-file-name (helm-current-directory))) (input (cond ((and (null hist) helm-find-files-ignore-thing-at-point) default-input) ((and (eq major-mode 'org-agenda-mode) org-directory (not smart-input)) (file-name-as-directory (expand-file-name org-directory))) ((and (eq major-mode 'dired-mode) smart-input) (file-name-directory smart-input)) ((and (not (string= smart-input "")) smart-input)) (t default-input))) (input-as-presel (null (file-directory-p input))) (presel (let ((it (or hist (and input-as-presel input) (buffer-file-name ...) (and ... smart-input) (and ... Info-current-file)))) (if it (if (and helm-ff-transformer-show-only-basename (null hist) (not ...)) (helm-basename it) it))))) (if (and hist (buffer-live-p (get-buffer helm-ff-history-buffer-name))) (progn (helm-set-local-variable 'helm-display-function (save-current-buffer (set-buffer helm-ff-history-buffer-name) helm-display-function) 'helm--last-frame-parameters (save-current-buffer (set-buffer helm-ff-history-buffer-name) helm--last-frame-parameters)))) (set-text-properties 0 (length input) nil input) (setq current-prefix-arg nil) (let ((helm--executing-helm-action (not (null hist)))) (helm-find-files-1 input (and presel (null helm-ff-no-preselect) (format helm-ff-last-expanded-candidate-regexp (regexp-quote presel))))))
helm-find-files(nil)
funcall-interactively(helm-find-files nil)
command-execute(helm-find-files)
can you please tell me how do you make the demo gift ? really cool.
Is it possible to insert rst skeletons instead of numpydoc?
It would be nice to have functions that automatically generate a skeleton for 'warning' and 'note'. For example:
def function(array, key):
"""
This function does ...
.. warning::
Possible warnings tba.
Docstring continued...
.. note::
The syntax should be ...
Parameters
----------
value : list
Array read from the parameter file
key : str
Name of the parameter
"""
could you please create a tag to use this package using melpa stable [1].
Thanks
[1] : http://stable.melpa.org/
Just as the title shows.
spacemacs is a A community-driven Emacs distribution. It is very powerful.
Sphinx has an extension, numpydoc, which enables a very popular docstring style that is used by numpy, scipy, and many other packages. It would be nice if sphinx-doc could generate docstrings using the syntax of numpydoc.
I find the package very convenient. Would it be possible to extend the functionality to classes and modules?
The init-value parameter for define-minor-mode is set to t. This enables the mode in non-python buffers as well, which is unfortunate. As far as I can tell from the documentation of define-minor-mode, there is no reason to set it to t initially. As with other minor modes, I'd prefer to enable it from python-mode-hook.
The current implementation assumes that all the field lists are added together but that may not always be the case. Sometimes the field lists could be interspersed by ReST directives such as .. versionchanged
or .. versionadded
as in these examples
Hi:
I just installed the elisp package from MELPA, and tried using it with my Python code. I keep getting the following error message when attempting to insert a new docstring into my code, and additionally, it always kills any existing docstring inside it, instead of updating it.
Suspicious state from syntax checker python-pycompile: Checker python-pycompile returned non-zero exit code 1, but no errors from output: Sorry: IndentationError: ('unexpected indent', ('/tmp/flycheck15795ZS0/app_utils.py', 84, 9, ' callback = mari.utils.connec()\n')) Checker definition probably flawed.
Is there anything I can do to resolve this?
Thanks!
If a field description is more than 2 lines long and if the docstring is regenerated, only 1st two lines of the description are retained. This looks like a bug in the regex for parsing the fields section of the docstring.
for eg.
:param pygerrit.client.GerritClient client: Gerrit client object
The existing docstring goes away when trying to update it.
I have some function that have PyLint control comments after their definition:
def some_func(param, param): # pylint: disable=unused-variable
pass
Calling sphinx-doc
doesn’t do anything, not even an error message is printed.
Consider the example:
def test(a="1%"):
pass
This will fail with error sphinx-doc-fun-args: Not enough arguments for format string
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.