comparison elpa/yasnippet-0.9.1/snippets/python-mode/class @ 141:ee4b6191b61e

packages: update yasnippet and deps
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 20 Apr 2016 13:40:19 -0400
parents elpa/yasnippet-0.8.0/snippets/python-mode/class@156cbb54f344
children
comparison
equal deleted inserted replaced
140:817e74b09115 141:ee4b6191b61e
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 # key: class
7 # --
8 class ${1:ClassName}(${2:object}):
9 """$3
10 """
11
12 def __init__(self, $4):
13 """$5
14 ${4:$
15 (let* ((indent
16 (concat "\n" (make-string (current-column) 32)))
17 (args
18 (mapconcat
19 '(lambda (x)
20 (if (not (string= (nth 0 x) ""))
21 (concat "- " (char-to-string 96) (nth 0 x)
22 (char-to-string 96) ":")))
23 (mapcar
24 '(lambda (x)
25 (mapcar
26 (lambda (x)
27 (replace-regexp-in-string "[[:blank:]]*$" ""
28 (replace-regexp-in-string "^[[:blank:]]*" "" x))) x))
29 (mapcar '(lambda (x) (split-string x "="))
30 (split-string text ",")))
31 indent)))
32 (if (string= args "")
33 (make-string 3 34)
34 (mapconcat
35 'identity
36 (list "" "Arguments:" args (make-string 3 34))
37 indent)))
38 }
39 ${4:$
40 (mapconcat
41 '(lambda (x)
42 (if (not (string= (nth 0 x) ""))
43 (concat "self._" (nth 0 x) " = " (nth 0 x))))
44 (mapcar
45 '(lambda (x)
46 (mapcar
47 '(lambda (x)
48 (replace-regexp-in-string "[[:blank:]]*$" ""
49 (replace-regexp-in-string "^[[:blank:]]*" "" x)))
50 x))
51 (mapcar '(lambda (x) (split-string x "="))
52 (split-string text ",")))
53 (concat "\n" (make-string (current-column) 32)))
54 }
55 $0