-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.json
More file actions
195 lines (195 loc) · 7.02 KB
/
python.json
File metadata and controls
195 lines (195 loc) · 7.02 KB
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
{
"#!/usr/bin/env python": {
"prefix": "env",
"body": "#!/usr/bin/env python\n$0",
"description": "Adds shebang line for default python interpreter."
},
"#!/usr/bin/env python3": {
"prefix": "env3",
"body": "#!/usr/bin/env python3\n$0",
"description": "Adds shebang line for default python 3 interpreter."
},
"# -*- coding=utf-8 -*-": {
"prefix": "enc",
"body": "# -*- coding=utf-8 -*-\n$0",
"description": "set default python2.x encoding specification to utf-8 as it is mentioned in pep-0263."
},
"# coding=utf-8": {
"prefix": "enco",
"body": "# coding=utf-8\n$0",
"description": "Set default python3 encoding specification to utf-8, by default this is the encoding for python3.x as it is mentioned in pep-3120."
},
"from future import ...": {
"prefix": "fenc",
"body": [
"# -*- coding: utf-8 -*-",
"from __future__ import absolute_import, division, print_function, unicode_literals"
],
"description": "Import future statement definitions for python2.x scripts using utf-8 as encoding."
},
"from future import ... v1": {
"prefix": "fenco",
"body": [
"# coding: utf-8",
"from __future__ import absolute_import, division, print_function, unicode_literals"
],
"description": "Import future statement definitions for python3.x scripts using utf-8 as encoding."
},
"import": {
"prefix": "im",
"body": "import ${1:package/module}$0",
"description": "Import a package or module"
},
"from ... import ...": {
"prefix": "fim",
"body": "from ${1:package/module} import ${2:names}$0",
"description": "Import statement that allows individual objects from the module to be imported directly into the caller\u2019s symbol table."
},
"class": {
"prefix": "class",
"body": [
"class ${1:classname}(${2:object}):",
"\t${3:pass}"
],
"description": "Code snippet for a class definition"
},
"New class": {
"prefix": "classi",
"body": "class ${1:ClassName}(${2:object}):\n\t\"\"\"${3:docstring for $1.}\"\"\"\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super($1, self).__init__()}\n\t\tself.arg = arg\n\t\t$0",
"description": "Code snippet for a class definition."
},
"New method": {
"prefix": "defs",
"body": "def ${1:mname}(self, ${2:arg}):\n\t${3:pass}$0",
"description": "Code snippet for a class method definition."
},
"New method w/ return": {
"prefix": "defst",
"body": "def ${1:mname}(self, ${2:arg}) -> ${3:return_type}:\n\t${4:pass}$0",
"description": "Code snippet for a class method definition."
},
"New function": {
"prefix": "def",
"body": "def ${1:fname}(${2:arg}):\n\t${3:pass}$0",
"description": "Code snippet for function definition."
},
"New function w/ return": {
"prefix": "deft",
"body": "def ${1:fname}(${2:arg}) -> ${3:return_type}:\n\t${4:pass}$0",
"description": "Code snippet for function definition."
},
"New async function": {
"prefix": "adef",
"body": "async def ${1:fname}(${2:arg}):\n\t${3:pass}$0",
"description": "Code snippet for async function definition."
},
"New property": {
"prefix": "property",
"body": "@property\ndef ${1:foo}(self):\n \"\"\"${2:The $1 property.}\"\"\"\n ${3:return self._$1}\n@${4:$1}.setter\ndef ${5:$1}(self, value):\n ${6:self._$1} = value",
"description": "New property: get and set via decorator"
},
"if": {
"prefix": "if",
"body": "if ${1:condition}:\n\t${2:pass}$0",
"description": "Code snippet for the if statement."
},
"if/else": {
"prefix": "if/else",
"body": [
"if ${1:condition}:",
"\t${2:pass}",
"else:",
"\t${3:pass}"
],
"description": "Code snippet for an if statement with else"
},
"elif": {
"prefix": "elif",
"body": [
"elif ${1:expression}:",
"\t${2:pass}"
],
"description": "Code snippet for an elif"
},
"else": {
"prefix": "else",
"body": [
"else:",
"\t${1:pass}"
],
"description": "Code snippet for an else"
},
"for": {
"prefix": "for",
"body": "for ${1:value} in ${2:iterable}:\n\t${3:pass}$0",
"description": "Code snippet to create a for loop structure."
},
"for/else": {
"prefix": "for/else",
"body": [
"for ${1:target_list} in ${2:expression_list}:",
"\t${3:pass}",
"else:",
"\t${4:pass}"
],
"description": "Code snippet for a for loop with else"
},
"while": {
"prefix": "while",
"body": "while ${1:condition}:\n\t${2:pass}$0",
"description": "Code snippet to create a while loop structure."
},
"while/else": {
"prefix": "while/else",
"body": [
"while ${1:expression}:",
"\t${2:pass}",
"else:",
"\t${3:pass}"
],
"description": "Code snippet for a while loop with else"
},
"try:except:": {
"prefix": "try",
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}$0",
"description": "Code Snippet for a try and except blocks."
},
"try:except:else:finally": {
"prefix": "tryef",
"body": "try:\n\t${1:pass}\nexcept${2: ${3:Exception} as ${4:e}}:\n\t${5:raise}\nelse:\n\t${6:pass}\nfinally:\n\t${7:pass}$0",
"description": "Code Snippet for a try/except/finally with else statement."
},
"try:except:else": {
"prefix": "trye",
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}\nelse:\n\t${5:pass}$0",
"description": "Code Snippet for a try/except with else statement."
},
"try:except:finally": {
"prefix": "tryf",
"body": "try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}\nfinally:\n\t${5:pass}$0",
"description": "Code Snippet for a try/except/finally."
},
"with": {
"prefix": "with",
"body": [
"with ${1:expression} as ${2:target}:",
"\t${3:pass}"
],
"description": "Code snippet for a with statement"
},
"self": {
"prefix": "s",
"body": "self.$0",
"description": "Shortend snippet to reference the self property in an object."
},
"__magic__": {
"prefix": "__",
"body": "__${1:init}__$0",
"description": "Code snippet to create magic methods."
},
"if __name__ == \"__main__\"": {
"prefix": "ifmain",
"body": "if __name__ == \"__main__\":\n\t${1:main()}$0",
"description": "Create implicitly all the code at the top level using the __name__ special variable."
}
}