corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | define("ace/snippets/python",["require","exports","module"], function(require, exports, module) { |
2 | "use strict"; |
||
3 | |||
4 | exports.snippetText = "snippet #!\n\ |
||
5 | #!/usr/bin/env python\n\ |
||
6 | snippet imp\n\ |
||
7 | import ${1:module}\n\ |
||
8 | snippet from\n\ |
||
9 | from ${1:package} import ${2:module}\n\ |
||
10 | # Module Docstring\n\ |
||
11 | snippet docs\n\ |
||
12 | '''\n\ |
||
13 | File: ${1:FILENAME:file_name}\n\ |
||
14 | Author: ${2:author}\n\ |
||
15 | Description: ${3}\n\ |
||
16 | '''\n\ |
||
17 | snippet wh\n\ |
||
18 | while ${1:condition}:\n\ |
||
19 | ${2:# TODO: write code...}\n\ |
||
20 | # dowh - does the same as do...while in other languages\n\ |
||
21 | snippet dowh\n\ |
||
22 | while True:\n\ |
||
23 | ${1:# TODO: write code...}\n\ |
||
24 | if ${2:condition}:\n\ |
||
25 | break\n\ |
||
26 | snippet with\n\ |
||
27 | with ${1:expr} as ${2:var}:\n\ |
||
28 | ${3:# TODO: write code...}\n\ |
||
29 | # New Class\n\ |
||
30 | snippet cl\n\ |
||
31 | class ${1:ClassName}(${2:object}):\n\ |
||
32 | \"\"\"${3:docstring for $1}\"\"\"\n\ |
||
33 | def __init__(self, ${4:arg}):\n\ |
||
34 | ${5:super($1, self).__init__()}\n\ |
||
35 | self.$4 = $4\n\ |
||
36 | ${6}\n\ |
||
37 | # New Function\n\ |
||
38 | snippet def\n\ |
||
39 | def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):\n\ |
||
40 | \"\"\"${3:docstring for $1}\"\"\"\n\ |
||
41 | ${4:# TODO: write code...}\n\ |
||
42 | snippet deff\n\ |
||
43 | def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):\n\ |
||
44 | ${3:# TODO: write code...}\n\ |
||
45 | # New Method\n\ |
||
46 | snippet defs\n\ |
||
47 | def ${1:mname}(self, ${2:arg}):\n\ |
||
48 | ${3:# TODO: write code...}\n\ |
||
49 | # New Property\n\ |
||
50 | snippet property\n\ |
||
51 | def ${1:foo}():\n\ |
||
52 | doc = \"${2:The $1 property.}\"\n\ |
||
53 | def fget(self):\n\ |
||
54 | ${3:return self._$1}\n\ |
||
55 | def fset(self, value):\n\ |
||
56 | ${4:self._$1 = value}\n\ |
||
57 | # Ifs\n\ |
||
58 | snippet if\n\ |
||
59 | if ${1:condition}:\n\ |
||
60 | ${2:# TODO: write code...}\n\ |
||
61 | snippet el\n\ |
||
62 | else:\n\ |
||
63 | ${1:# TODO: write code...}\n\ |
||
64 | snippet ei\n\ |
||
65 | elif ${1:condition}:\n\ |
||
66 | ${2:# TODO: write code...}\n\ |
||
67 | # For\n\ |
||
68 | snippet for\n\ |
||
69 | for ${1:item} in ${2:items}:\n\ |
||
70 | ${3:# TODO: write code...}\n\ |
||
71 | # Encodes\n\ |
||
72 | snippet cutf8\n\ |
||
73 | # -*- coding: utf-8 -*-\n\ |
||
74 | snippet clatin1\n\ |
||
75 | # -*- coding: latin-1 -*-\n\ |
||
76 | snippet cascii\n\ |
||
77 | # -*- coding: ascii -*-\n\ |
||
78 | # Lambda\n\ |
||
79 | snippet ld\n\ |
||
80 | ${1:var} = lambda ${2:vars} : ${3:action}\n\ |
||
81 | snippet .\n\ |
||
82 | self.\n\ |
||
83 | snippet try Try/Except\n\ |
||
84 | try:\n\ |
||
85 | ${1:# TODO: write code...}\n\ |
||
86 | except ${2:Exception}, ${3:e}:\n\ |
||
87 | ${4:raise $3}\n\ |
||
88 | snippet try Try/Except/Else\n\ |
||
89 | try:\n\ |
||
90 | ${1:# TODO: write code...}\n\ |
||
91 | except ${2:Exception}, ${3:e}:\n\ |
||
92 | ${4:raise $3}\n\ |
||
93 | else:\n\ |
||
94 | ${5:# TODO: write code...}\n\ |
||
95 | snippet try Try/Except/Finally\n\ |
||
96 | try:\n\ |
||
97 | ${1:# TODO: write code...}\n\ |
||
98 | except ${2:Exception}, ${3:e}:\n\ |
||
99 | ${4:raise $3}\n\ |
||
100 | finally:\n\ |
||
101 | ${5:# TODO: write code...}\n\ |
||
102 | snippet try Try/Except/Else/Finally\n\ |
||
103 | try:\n\ |
||
104 | ${1:# TODO: write code...}\n\ |
||
105 | except ${2:Exception}, ${3:e}:\n\ |
||
106 | ${4:raise $3}\n\ |
||
107 | else:\n\ |
||
108 | ${5:# TODO: write code...}\n\ |
||
109 | finally:\n\ |
||
110 | ${6:# TODO: write code...}\n\ |
||
111 | # if __name__ == '__main__':\n\ |
||
112 | snippet ifmain\n\ |
||
113 | if __name__ == '__main__':\n\ |
||
114 | ${1:main()}\n\ |
||
115 | # __magic__\n\ |
||
116 | snippet _\n\ |
||
117 | __${1:init}__${2}\n\ |
||
118 | # python debugger (pdb)\n\ |
||
119 | snippet pdb\n\ |
||
120 | import pdb; pdb.set_trace()\n\ |
||
121 | # ipython debugger (ipdb)\n\ |
||
122 | snippet ipdb\n\ |
||
123 | import ipdb; ipdb.set_trace()\n\ |
||
124 | # ipython debugger (pdbbb)\n\ |
||
125 | snippet pdbbb\n\ |
||
126 | import pdbpp; pdbpp.set_trace()\n\ |
||
127 | snippet pprint\n\ |
||
128 | import pprint; pprint.pprint(${1})${2}\n\ |
||
129 | snippet \"\n\ |
||
130 | \"\"\"\n\ |
||
131 | ${1:doc}\n\ |
||
132 | \"\"\"\n\ |
||
133 | # test function/method\n\ |
||
134 | snippet test\n\ |
||
135 | def test_${1:description}(${2:self}):\n\ |
||
136 | ${3:# TODO: write code...}\n\ |
||
137 | # test case\n\ |
||
138 | snippet testcase\n\ |
||
139 | class ${1:ExampleCase}(unittest.TestCase):\n\ |
||
140 | \n\ |
||
141 | def test_${2:description}(self):\n\ |
||
142 | ${3:# TODO: write code...}\n\ |
||
143 | snippet fut\n\ |
||
144 | from __future__ import ${1}\n\ |
||
145 | #getopt\n\ |
||
146 | snippet getopt\n\ |
||
147 | try:\n\ |
||
148 | # Short option syntax: \"hv:\"\n\ |
||
149 | # Long option syntax: \"help\" or \"verbose=\"\n\ |
||
150 | opts, args = getopt.getopt(sys.argv[1:], \"${1:short_options}\", [${2:long_options}])\n\ |
||
151 | \n\ |
||
152 | except getopt.GetoptError, err:\n\ |
||
153 | # Print debug info\n\ |
||
154 | print str(err)\n\ |
||
155 | ${3:error_action}\n\ |
||
156 | \n\ |
||
157 | for option, argument in opts:\n\ |
||
158 | if option in (\"-h\", \"--help\"):\n\ |
||
159 | ${4}\n\ |
||
160 | elif option in (\"-v\", \"--verbose\"):\n\ |
||
161 | verbose = argument\n\ |
||
162 | "; |
||
163 | exports.scope = "python"; |
||
164 | |||
165 | }); |