Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcea5b6c

Browse files
authored
Merge branch 'master' intocstrapGH-12
2 parentsb9f1d14 +31e42b5 commitcea5b6c

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#Change Log
22
All notable changes to the "python-snippets" extension will be documented in this file.
33

4+
##[0.1.0]
5+
6+
- Merge PRs#15,#16,#17
7+
48
##[0.0.9]
59
- Merge PR#11
610

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Thanks!
2323
| im| import|
2424
| fim| from ... import ...|
2525
| class| New class|
26+
| classd| New dataclass|
2627
| defs| New method|
2728
| def| New function|
2829
| adef| Async function|
2930
| property| New property|
31+
| enum| New Enum|
3032
| if| if|
3133
| for| for|
3234
| while| while|

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name":"python-snippets",
33
"displayName":"python-snippets",
44
"description":"Python Snippets",
5-
"version":"0.0.9",
5+
"version":"0.1.0",
66
"publisher":"cstrap",
77
"icon":"images/python.png",
88
"engines": {

‎snippets/base.json‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,28 @@
4747
},
4848
"New class": {
4949
"prefix":"class",
50-
"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",
50+
"body": [
51+
"class ${1:ClassName}(${2:object}):",
52+
"\t\"\"\"${3:docstring for $1.}\"\"\"",
53+
"\tdef __init__(self, ${4:arg}):",
54+
"\t\t${5:super($1, self).__init__()}",
55+
"\t\tself.$4 = $4",
56+
"\t\t$0"
57+
],
5158
"description" :"Code snippet for a class definition."
5259
},
60+
"New dataclass": {
61+
"prefix":"classd",
62+
"body": [
63+
"from dataclasses import dataclass\n\n",
64+
"@dataclass",
65+
"class ${1:ClassName}(${2:object}):",
66+
"\t\"\"\"${3:Docstring for $1.}\"\"\"",
67+
"\t${4:property}: ${type}",
68+
"\t$0"
69+
],
70+
"description":"Code snippet for a dataclass definition."
71+
},
5372
"New method": {
5473
"prefix":"defs",
5574
"body":"def ${1:mname}(self, ${2:arg}):\n\t${3:pass}$0",
@@ -75,6 +94,18 @@
7594
"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",
7695
"description" :""
7796
},
97+
"New enum": {
98+
"prefix":"enum",
99+
"body": [
100+
"from enum import Enum\n\n",
101+
"class ${1:MyEnum}(Enum):",
102+
"\t\"\"\"${2:Docstring for $1.}\"\"\"",
103+
"\t${3:FIRST_ENUM} =\"some_value\"",
104+
"\t${4:SECOND_ENUM} =\"some_other_value\"",
105+
"\t$0"
106+
],
107+
"description":"Code snippet for enum definition."
108+
},
78109
"if": {
79110
"prefix":"if",
80111
"body":"if ${1:condition}:\n\t${2:pass}$0",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp