1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
{
"#!": {
"prefix": "#!",
"description": "#!/usr/bin/env python",
"body": [
"#!/usr/bin/env python",
"$0"
],
"luasnip": {
"priority": -50
}
},
"#!2": {
"prefix": "#!2",
"description": "#!/usr/bin/env python2",
"body": [
"#!/usr/bin/env python2",
"# -*- coding: utf-8 -*-",
"$0"
]
},
"#!3": {
"prefix": "#!3",
"description": "#!/usr/bin/env python3",
"body": [
"#!/usr/bin/env python3",
"$0"
]
},
"contain": {
"prefix": "contain",
"description": "methods for emulating a container type",
"body": [
"def __len__(self):",
"\t${1:pass}",
"",
"def __getitem__(self, key):",
"\t${2:pass}",
"",
"def __setitem__(self, key, value):",
"\t${3:pass}",
"",
"def __delitem__(self, key):",
"\t${4:pass}",
"",
"def __iter__(self):",
"\t${5:pass}",
"",
"def __reversed__(self):",
"\t${6:pass}",
"",
"def __contains__(self, item):",
"\t${7:pass}"
]
},
"context": {
"prefix": "context",
"description": "context manager methods",
"body": [
"def __enter__(self):",
"\t${1:pass}",
"",
"def __exit__(self, exc_type, exc_value, traceback):",
"\t${2:pass}"
]
},
"attr": {
"prefix": "attr",
"description": "methods for customizing attribute access",
"body": [
"def __getattr__(self, name):",
"\t${1:pass}",
"",
"def __setattr__(self, name, value):",
"\t${2:pass}",
"",
"def __delattr__(self, name):",
"\t${3:pass}"
]
},
"desc": {
"prefix": "desc",
"description": "methods implementing descriptors",
"body": [
"def __get__(self, instance, owner):",
"\t${1:pass}",
"",
"def __set__(self, instance, value):",
"\t${2:pass}",
"",
"def __delete__(self, instance):",
"\t${3:pass}"
]
},
"cmp": {
"prefix": "cmp",
"description": "methods implementing rich comparison",
"body": [
"def __eq__(self, other):",
"\t${1:pass}",
"",
"def __ne__(self, other):",
"\t${2:pass}",
"",
"def __lt__(self, other):",
"\t${3:pass}",
"",
"def __le__(self, other):",
"\t${4:pass}",
"",
"def __gt__(self, other):",
"\t${5:pass}",
"",
"def __ge__(self, other):",
"\t${6:pass}",
"",
"def __cmp__(self, other):",
"\t${7:pass}"
]
},
"repr": {
"prefix": "repr",
"description": "methods implementing string representation",
"body": [
"def __repr__(self):",
"\t${1:pass}",
"",
"def __str__(self):",
"\t${2:pass}",
"",
"def __unicode__(self):",
"\t${3:pass}"
]
},
"numeric": {
"prefix": "numeric",
"description": "methods for emulating a numeric type",
"body": [
"def __add__(self, other):",
"\t${1:pass}",
"",
"def __sub__(self, other):",
"\t${2:pass}",
"",
"def __mul__(self, other):",
"\t${3:pass}",
"",
"def __div__(self, other):",
"\t${4:pass}",
"",
"def __truediv__(self, other):",
"\t${5:pass}",
"",
"def __floordiv__(self, other):",
"\t${6:pass}",
"",
"",
"def __mod__(self, other):",
"\t${7:pass}",
"",
"def __divmod__(self, other):",
"\t${8:pass}",
"",
"def __pow__(self, other):",
"\t${9:pass}",
"",
"",
"def __lshift__(self, other):",
"\t${10:pass}",
"",
"def __rshift__(self, other):",
"\t${11:pass}",
"",
"def __and__(self, other):",
"\t${12:pass}",
"",
"def __xor__(self, other):",
"\t${13:pass}",
"",
"def __or__(self, other):",
"\t${14:pass}",
"",
"",
"def __neg__(self):",
"\t${15:pass}",
"",
"def __pos__(self):",
"\t${16:pass}",
"",
"def __abs__(self):",
"\t${17:pass}",
"",
"def __invert__(self):",
"\t${18:pass}",
"",
"",
"def __complex__(self):",
"\t${19:pass}",
"",
"def __int__(self):",
"\t${20:pass}",
"",
"def __long__(self):",
"\t${21:pass}",
"",
"def __float__(self):",
"\t${22:pass}",
"",
"",
"def __oct__(self):",
"\t${22:pass}",
"",
"def __hex__(self):",
"\t${23:pass}",
"",
"",
"def __index__(self):",
"\t${24:pass}",
"",
"def __coerce__(self, other):",
"\t${25:pass}"
]
},
"from": {
"prefix": "from",
"description": "from module import name",
"body": "from ${1:module} import ${2:Stuff}"
},
"roprop": {
"prefix": "roprop",
"description": "Read Only Property",
"body": [
"@property",
"def ${1:name}(self):",
"\t${2:return self._$1}$0"
]
},
"match": {
"prefix": "match",
"description": "Structural pattern matching",
"body": [
"match ${1:expression}:",
"\tcase ${2:pattern_1}:",
"\t\t${3:pass}",
"\tcase ${4:pattern_2}:",
"\t\t${0:pass}"
]
},
"matchw": {
"prefix": "matchw",
"description": "Pattern matching with wildcard",
"body": [
"match ${1:expression}:",
"\tcase ${2:pattern_1}:",
"\t\t${3:pass}",
"\tcase _:",
"\t\t${0:pass}"
]
}
}
|