This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
/
language-python.cson
74 lines (74 loc) · 2.87 KB
/
language-python.cson
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
'.source.python':
'#!/usr/bin/env python':
'prefix': 'env'
'body': '#!/usr/bin/env python\n'
'# -*- coding: utf-8 -*-':
'prefix': 'enc'
'body': '# -*- coding: utf-8 -*-\n'
'Assert Equal':
'prefix': 'ase'
'body': 'self.assertEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
'Assert Not Equal':
'prefix': 'asne'
'body': 'self.assertNotEqual(${1:expected}, ${2:actual}${3:, \'${4:message}\'})$0'
'Assert Raises':
'prefix': 'asr'
'body': 'self.assertRaises(${1:exception}, ${2:callable})$0'
'Assert':
'prefix': 'as'
'body': 'self.assert_(${1:boolean expression}${2:, \'${3:message}\'})$0'
'Fail (a test)':
'prefix': 'fail'
'body': 'self.fail(\'${1:message}\')$0'
'New Class':
'prefix': 'class'
'body': 'class ${1:ClassName}(${2:object}):\n\t"""${3:docstring for ClassName}"""\n\tdef __init__(self, ${4:arg}):\n\t\t${5:super(ClassName, self).__init__()}\n\t\tself.arg = arg\n\t\t$0'
'New Method':
'prefix': 'defs'
'body': 'def ${1:mname}(self, ${2:arg}):\n\t${3:pass}'
'New Function':
'prefix': 'def'
'body': 'def ${1:fname}(${2:arg}):\n\t${3:pass}'
'New Property':
'prefix': 'property'
'body': 'def ${1:foo}():\n doc = "${2:The $1 property.}"\n def fget(self):\n ${3:return self._$1}\n def fset(self, value):\n ${4:self._$1 = value}\n def fdel(self):\n ${5:del self._$1}\n return locals()\n$1 = property(**$1())$0'
'if':
'prefix': 'if'
'body': 'if ${1:condition}:\n\t${2:pass}'
'for':
'prefix': 'for'
'body': 'for ${1:value} in ${2:variable}:\n\t${3:pass}'
'while':
'prefix': 'while'
'body': 'while ${1:condition}:\n\t${2:pass}'
'Try/Except/Else/Finally':
'prefix': 'try'
'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}'
'Try/Except/Else':
'prefix': 'try'
'body': 'try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}\nelse:\n\t${5:pass}'
'Try/Except/Finally':
'prefix': 'try'
'body': 'try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}\nfinally:\n\t${5:pass}'
'Try/Except':
'prefix': 'try'
'body': 'try:\n\t${1:pass}\nexcept ${2:Exception} as ${3:e}:\n\t${4:raise $3}'
'List Comprehension':
'prefix': 'lc'
'body': '[${1:value} for ${2:value} in ${3:variable}]'
'List Comprehension If Else':
'prefix': 'lcie'
'body': '[${1:value} if ${2:condition} else ${3:condition} for ${4:value} in ${5:variable}]'
'Dictionary Comprehension':
'prefix': 'dc'
'body': '{${1:key}: ${2:value} for ${3:key}, ${4:value} in ${5:variable}}'
'__magic__':
'prefix': '__'
'body': '__${1:init}__'
'if __name__ == \'__main__\'':
'prefix': 'ifmain'
'body': 'if __name__ == \'__main__\':\n\t${1:main()}$0'
'.source.python:not(.string)':
'self':
'prefix': '.'
'body': 'self.'