diff options
| author | Simeon Simeonov | 2015-02-06 15:12:52 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2015-02-06 15:12:52 +0100 |
| commit | b5d0bc24d0c062127bec902b359334afd113a416 (patch) | |
| tree | acdaf3e6a60c29c87061955fbe8f02119b94cd27 /.emacs.d/snippets/python-mode | |
| parent | 897eee81de8b3f6adf0165f50e95600a7b89c20c (diff) | |
Added dunder, property_getter and property_setter for python-mode
Diffstat (limited to '.emacs.d/snippets/python-mode')
| -rw-r--r-- | .emacs.d/snippets/python-mode/cls | 2 | ||||
| -rw-r--r-- | .emacs.d/snippets/python-mode/dunder | 5 | ||||
| -rw-r--r-- | .emacs.d/snippets/python-mode/property_getter | 13 | ||||
| -rw-r--r-- | .emacs.d/snippets/python-mode/property_setter | 19 |
4 files changed, 38 insertions, 1 deletions
diff --git a/.emacs.d/snippets/python-mode/cls b/.emacs.d/snippets/python-mode/cls index 9f8b27c..3e3863a 100644 --- a/.emacs.d/snippets/python-mode/cls +++ b/.emacs.d/snippets/python-mode/cls | |||
| @@ -3,5 +3,5 @@ | |||
| 3 | # key: cls | 3 | # key: cls |
| 4 | # group: object oriented | 4 | # group: object oriented |
| 5 | # -- | 5 | # -- |
| 6 | class ${1:class}: | 6 | class ${1:class}(${2:object}): |
| 7 | $0 | 7 | $0 |
diff --git a/.emacs.d/snippets/python-mode/dunder b/.emacs.d/snippets/python-mode/dunder new file mode 100644 index 0000000..7c97482 --- /dev/null +++ b/.emacs.d/snippets/python-mode/dunder | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: dunder | ||
| 3 | # key: dd | ||
| 4 | # -- | ||
| 5 | __${name}__$0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode/property_getter b/.emacs.d/snippets/python-mode/property_getter new file mode 100644 index 0000000..332896c --- /dev/null +++ b/.emacs.d/snippets/python-mode/property_getter | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: property_getter | ||
| 3 | # key: pg | ||
| 4 | # group : code_generation | ||
| 5 | # -- | ||
| 6 | @property | ||
| 7 | def ${1:name}(self): | ||
| 8 | """ | ||
| 9 | $1-property | ||
| 10 | """ | ||
| 11 | return self.${2:value} | ||
| 12 | |||
| 13 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode/property_setter b/.emacs.d/snippets/python-mode/property_setter new file mode 100644 index 0000000..40c879b --- /dev/null +++ b/.emacs.d/snippets/python-mode/property_setter | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: property_setter | ||
| 3 | # key: ps | ||
| 4 | # group : code_generation | ||
| 5 | # -- | ||
| 6 | @property | ||
| 7 | def ${1:name}(self): | ||
| 8 | """ | ||
| 9 | $1-property | ||
| 10 | """ | ||
| 11 | return self.${2:value} | ||
| 12 | |||
| 13 | @$1.setter | ||
| 14 | def $1(self, value): | ||
| 15 | """ | ||
| 16 | $1-property setter | ||
| 17 | """ | ||
| 18 | self.$2 = value | ||
| 19 | $0 | ||
