summaryrefslogtreecommitdiff
path: root/.emacs.d/mysnippets/text-mode/python-mode/class
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/mysnippets/text-mode/python-mode/class')
-rw-r--r--.emacs.d/mysnippets/text-mode/python-mode/class54
1 files changed, 54 insertions, 0 deletions
diff --git a/.emacs.d/mysnippets/text-mode/python-mode/class b/.emacs.d/mysnippets/text-mode/python-mode/class
new file mode 100644
index 0000000..72f339b
--- /dev/null
+++ b/.emacs.d/mysnippets/text-mode/python-mode/class
@@ -0,0 +1,54 @@
1# -*- coding: utf-8 -*-
2# name: class
3# contributor: Orestis Markou
4# contributor: Nishio Hirokazu
5# contributor: Yasser González Fernández <yglez@uh.cu>
6# --
7class ${1:ClassName}(${2:object}):
8 """$3
9 """
10
11 def __init__(self, $4):
12 """$5
13 ${4:$
14 (let* ((indent
15 (concat "\n" (make-string (current-column) 32)))
16 (args
17 (mapconcat
18 '(lambda (x)
19 (if (not (string= (nth 0 x) ""))
20 (concat "- " (char-to-string 96) (nth 0 x)
21 (char-to-string 96) ":")))
22 (mapcar
23 '(lambda (x)
24 (mapcar
25 (lambda (x)
26 (replace-regexp-in-string "[[:blank:]]*$" ""
27 (replace-regexp-in-string "^[[:blank:]]*" "" x))) x))
28 (mapcar '(lambda (x) (split-string x "="))
29 (split-string text ",")))
30 indent)))
31 (if (string= args "")
32 (make-string 3 34)
33 (mapconcat
34 'identity
35 (list "" "Arguments:" args (make-string 3 34))
36 indent)))
37 }
38 ${4:$
39 (mapconcat
40 '(lambda (x)
41 (if (not (string= (nth 0 x) ""))
42 (concat "self._" (nth 0 x) " = " (nth 0 x))))
43 (mapcar
44 '(lambda (x)
45 (mapcar
46 '(lambda (x)
47 (replace-regexp-in-string "[[:blank:]]*$" ""
48 (replace-regexp-in-string "^[[:blank:]]*" "" x)))
49 x))
50 (mapcar '(lambda (x) (split-string x "="))
51 (split-string text ",")))
52 (concat "\n" (make-string (current-column) 32)))
53 }
54 $0