11{
2- "class " : {
3- "prefix" : " class " ,
2+ "if " : {
3+ "prefix" : " if " ,
44 "body" : [
5- " class ${name}${bases }:" ,
6- " \t ${selected }"
5+ " if ${expression }:" ,
6+ " \t ${suite }"
77 ],
8- "description" : " Code snippet for a class definition "
8+ "description" : " Code snippet for an if statement "
99 },
10- "def " : {
11- "prefix" : " def " ,
10+ "if/else " : {
11+ "prefix" : " if/else " ,
1212 "body" : [
13- " def ${name}(${args}):" ,
14- " \t ${selected}"
13+ " if ${condition}:" ,
14+ " \t ${1:suite}" ,
15+ " else:"
16+ " \t ${2:suite}"
1517 ],
16- "description" : " Code snippet for a function definition "
18+ "description" : " Code snippet for an if statement with else "
1719 },
18- "except (try/except) " : {
19- "prefix" : " except " ,
20+ "elif " : {
21+ "prefix" : " elif " ,
2022 "body" : [
21- " try:" ,
22- " \t pass" ,
23- " except ${exception}:" ,
24- " \t ${selected}"
23+ " elif ${expression}:" ,
24+ " \t ${suite}"
25+ ],
26+ "description" : " Code snippet for an elif"
27+ },
28+ "else" : {
29+ "prefix" : " else" ,
30+ "body" : [
31+ " else:" ,
32+ " \t ${suite}"
33+ ],
34+ "description" : " Code snippet for an else"
35+ },
36+ "while" : {
37+ "prefix" : " while" ,
38+ "body" : [
39+ " while ${expression}:" ,
40+ " \t ${suite}"
41+ ],
42+ "description" : " Code snippet for a while loop"
43+ },
44+ "while/else" : {
45+ "prefix" : " while/else" ,
46+ "body" : [
47+ " while ${expression}:" ,
48+ " \t ${1:suite}"
49+ " else:" ,
50+ " \t ${2:suite}"
2551 ],
26- "description" : " Code snippet for a try statement "
52+ "description" : " Code snippet for a while loop with else "
2753 },
2854 "for" : {
2955 "prefix" : " for" ,
3056 "body" : [
31- " for ${var } in ${expr }:" ,
32- " \t ${selected }"
57+ " for ${target_list } in ${expression_list }:" ,
58+ " \t ${suite }"
3359 ],
3460 "description" : " Code snippet for a for loop"
3561 },
36- "if " : {
37- "prefix" : " if " ,
62+ "for/else " : {
63+ "prefix" : " for/else " ,
3864 "body" : [
39- " if ${condition}:" ,
40- " \t ${selected}"
65+ " for ${target_list} in ${expression_list}:" ,
66+ " \t ${1:suite}" ,
67+ " else:" ,
68+ " \t ${2:suite}"
4169 ],
42- "description" : " Code snippet for an if statement "
70+ "description" : " Code snippet for a for loop with else "
4371 },
44- "main function " : {
45- "prefix" : " main " ,
72+ "try/except " : {
73+ "prefix" : " try/except " ,
4674 "body" : [
47- " def main():" ,
48- " \t ${selected}" ,
49- " " ,
50- " if __name__ == \" __main__\" :" ,
51- " \t sys.exit(int(main() or 0))"
75+ " try:" ,
76+ " \t ${1:suite}" ,
77+ " except ${expression} as ${identifier}:" ,
78+ " \t ${2:suite}"
5279 ],
53- "description" : " Code snippet for a main function "
80+ "description" : " Code snippet for a try/except statement "
5481 },
55- "try" : {
56- "prefix" : " try" ,
82+ "try/finally " : {
83+ "prefix" : " try/finally " ,
5784 "body" : [
5885 " try:" ,
59- " \t ${selected }" ,
60- " except ${exception} :" ,
61- " \t $0pass "
86+ " \t ${1:suite }" ,
87+ " finally :" ,
88+ " \t ${2:suite} "
6289 ],
63- "description" : " Code snippet for a try statement"
90+ "description" : " Code snippet for a try/finally statement"
6491 },
65- "while " : {
66- "prefix" : " while " ,
92+ "try/except/else " : {
93+ "prefix" : " try/except/else " ,
6794 "body" : [
68- " while ${condition}:" ,
69- " \t ${selected}"
95+ " try:" ,
96+ " \t ${1:suite}" ,
97+ " except ${expression} as ${identifier}:" ,
98+ " \t ${2:suite}" ,
99+ " else:" ,
100+ " \t ${3:suite}"
70101 ],
71- "description" : " Code snippet for a while loop"
102+ "description" : " Code snippet for a try/except/else statement"
103+ },
104+ "try/except/finally" : {
105+ "prefix" : " try/except/finally" ,
106+ "body" : [
107+ " try:" ,
108+ " \t ${1:suite}" ,
109+ " except ${expression} as ${identifier}:" ,
110+ " \t ${2:suite}" ,
111+ " finally:" ,
112+ " \t ${3:suite}"
113+ ],
114+ "description" : " Code snippet for a try/except/finally statement"
115+ },
116+ "try/except/else/finally" : {
117+ "prefix" : " try/except/else/finally" ,
118+ "body" : [
119+ " try:" ,
120+ " \t ${1:suite}" ,
121+ " except ${expression} as ${identifier}:" ,
122+ " \t ${2:suite}" ,
123+ " else:" ,
124+ " \t ${3:suite}" ,
125+ " finally:" ,
126+ " \t ${4:suite}"
127+ ],
128+ "description" : " Code snippet for a try/except/else/finally statement"
72129 },
73130 "with" : {
74131 "prefix" : " with" ,
75132 "body" : [
76- " with ${ctx }:" ,
77- " \t ${selected }"
133+ " with ${expression} as ${target }:" ,
134+ " \t ${suite }"
78135 ],
79136 "description" : " Code snippet for a with statement"
137+ },
138+ "def" : {
139+ "prefix" : " def" ,
140+ "body" : [
141+ " def ${funcname}(${parameter_list}):" ,
142+ " \t ${suite}"
143+ ],
144+ "description" : " Code snippet for a function definition"
145+ },
146+ "def(class method)" : {
147+ "prefix" : " def(class method)" ,
148+ "body" : [
149+ " def ${funcname}(self, ${parameter_list}):" ,
150+ " \t ${suite}"
151+ ],
152+ "description" : " Code snippet for a class method"
153+ },
154+ "def(static class method)" : {
155+ "prefix" : " def(static class method)" ,
156+ "body" : [
157+ " @staticmethod" ,
158+ " def ${funcname}(${parameter_list}):" ,
159+ " \t ${suite}"
160+ ],
161+ "description" : " Code snippet for a static class method"
162+ },
163+ "class" : {
164+ "prefix" : " class" ,
165+ "body" : [
166+ " class ${classname}(${object}):" ,
167+ " \t ${suite}"
168+ ],
169+ "description" : " Code snippet for a class definition"
170+ },
171+ "lambda" : {
172+ "prefix" : " lambda" ,
173+ "body" : [
174+ " lambda ${parameter_list}: ${expression}"
175+ ],
176+ "description" : " Code snippet for a lambda statement"
177+ },
178+ "if(main)" : {
179+ "prefix" : " if(main)" ,
180+ "body" : [
181+ " def main():" ,
182+ " \t ${suite}" ,
183+ " " ,
184+ " if __name__ == '__main__':" ,
185+ " \t sys.exit(int(main() or 0))"
186+ ],
187+ "description" : " Code snippet for a main function"
188+ },
189+ "async/def" : {
190+ "prefix" : " async/def" ,
191+ "body" : [
192+ " async def ${funcname}(${parameter_list}):" ,
193+ " \t ${suite}"
194+ ],
195+ "description" : " Code snippet for a async statement"
196+ },
197+ "async/for" : {
198+ "prefix" : " async/for" ,
199+ "body" : [
200+ " async for ${target} in ${iter}:" ,
201+ " \t ${block}"
202+ ],
203+ "description" : " Code snippet for a async for statement"
204+ },
205+ "async/for/else" : {
206+ "prefix" : " async/for/else" ,
207+ "body" : [
208+ " async for ${target} in ${iter}:" ,
209+ " \t ${1:block}" ,
210+ " else:" ,
211+ " \t ${2:block}"
212+ ],
213+ "description" : " Code snippet for a async for statement with else"
214+ },
215+ "async/with" : {
216+ "prefix" : " async/with" ,
217+ "body" : [
218+ " async with ${expr} in ${var}:" ,
219+ " \t ${block}"
220+ ],
221+ "description" : " Code snippet for a async with statement"
80222 }
81223}
0 commit comments