From d038813fd1a8c740fc0a362756263ec32b119069 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Wed, 13 Feb 2019 13:52:15 +0100 Subject: Improve doctric snippets for Python (remove docstring_rtype and docstring_type) --- .emacs.d/snippets/python-mode/.yas-setup.el | 2 +- .emacs.d/snippets/python-mode/docstring_param | 3 ++- .emacs.d/snippets/python-mode/docstring_return | 3 ++- .emacs.d/snippets/python-mode/docstring_rtype | 5 ----- .emacs.d/snippets/python-mode/docstring_type | 5 ----- .emacs.d/snippets/python-mode/function_docstring | 8 ++++---- 6 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 .emacs.d/snippets/python-mode/docstring_rtype delete mode 100644 .emacs.d/snippets/python-mode/docstring_type (limited to '.emacs.d/snippets/python-mode') diff --git a/.emacs.d/snippets/python-mode/.yas-setup.el b/.emacs.d/snippets/python-mode/.yas-setup.el index 2f52c4f..7603e4d 100644 --- a/.emacs.d/snippets/python-mode/.yas-setup.el +++ b/.emacs.d/snippets/python-mode/.yas-setup.el @@ -14,7 +14,7 @@ (max-len (if args (apply 'max (mapcar (lambda (x) (length (nth 0 x))) args)) 0)) (formatted-args (mapconcat (lambda (x) - (concat ":param " (nth 0 x) ":\n:type " (nth 0 x) ": object\n" + (concat ":param " (nth 0 x) ":\n:type " (nth 0 x) ":\n" (if (nth 1 x) (concat "\(default " (nth 1 x) "\)")))) args indent))) diff --git a/.emacs.d/snippets/python-mode/docstring_param b/.emacs.d/snippets/python-mode/docstring_param index a371d93..aa8b880 100644 --- a/.emacs.d/snippets/python-mode/docstring_param +++ b/.emacs.d/snippets/python-mode/docstring_param @@ -2,4 +2,5 @@ # name: docstring_param # key: P # -- -:param $1: $0 \ No newline at end of file +:param $1: $0 +:type $1: \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/docstring_return b/.emacs.d/snippets/python-mode/docstring_return index 90c05e5..4bf2f16 100644 --- a/.emacs.d/snippets/python-mode/docstring_return +++ b/.emacs.d/snippets/python-mode/docstring_return @@ -2,4 +2,5 @@ # name: docstring_return # key: R # -- -:return: $0 \ No newline at end of file +:return: $0 +:rtype: \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/docstring_rtype b/.emacs.d/snippets/python-mode/docstring_rtype deleted file mode 100644 index 24943bc..0000000 --- a/.emacs.d/snippets/python-mode/docstring_rtype +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: docstring_rtype -# key: RT -# -- -:rtype: $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/docstring_type b/.emacs.d/snippets/python-mode/docstring_type deleted file mode 100644 index 0a9e154..0000000 --- a/.emacs.d/snippets/python-mode/docstring_type +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: docstring_type -# key: T -# -- -:type $1: $0 \ No newline at end of file diff --git a/.emacs.d/snippets/python-mode/function_docstring b/.emacs.d/snippets/python-mode/function_docstring index f372d26..685eaf5 100644 --- a/.emacs.d/snippets/python-mode/function_docstring +++ b/.emacs.d/snippets/python-mode/function_docstring @@ -5,7 +5,7 @@ # NOTE: Use minimum indentation, because Emacs 25+ doesn't dedent docstrings. # -- def ${1:name}($2): - \"\"\"$3 - ${2:$(python-args-to-docstring)} - \"\"\" - $0 \ No newline at end of file + \"\"\"$3 + ${2:$(python-args-to-docstring)} + \"\"\" + $0 \ No newline at end of file -- cgit v1.3