Skip to content

Commit d7c1849

Browse files
committed
Add enum snippet for creating enums
1 parent 4da7935 commit d7c1849

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Thanks!
2727
| def | New function |
2828
| adef | Async function |
2929
| property | New property |
30+
| enum | New Enum |
3031
| if | if |
3132
| for | for |
3233
| while | while |

snippets/base.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@
7575
"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",
7676
"description" : ""
7777
},
78+
"New enum": {
79+
"prefix": "enum",
80+
"body": [
81+
"from enum import Enum\n\n",
82+
"class ${1:MyEnum}(Enum):",
83+
"\t\"\"\"${2:Docstring for $1.}\"\"\"",
84+
"\t${3:FIRST_ENUM} = \"some_value\"",
85+
"\t${4:SECOND_ENUM} = \"some_other_value\"",
86+
"\t$0"
87+
]
88+
}
7889
"if": {
7990
"prefix": "if",
8091
"body": "if ${1:condition}:\n\t${2:pass}$0",

0 commit comments

Comments
 (0)