diff options
| author | Simeon Simeonov | 2021-01-12 20:05:37 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2021-01-12 20:05:37 +0100 |
| commit | 4996a6403108a226d4ff1d73b880207cc80284bd (patch) | |
| tree | 4ed642a366a34775d3401228db1f7bb10752b1b4 | |
| parent | 4fbfa5db6d2819f528698b78d15634affdf9b9a9 (diff) | |
Add snippets/python-mode.statnett
49 files changed, 356 insertions, 7 deletions
diff --git a/.emacs.d/snippets/python-mode.statnett/.yas-parents b/.emacs.d/snippets/python-mode.statnett/.yas-parents new file mode 100644 index 0000000..75d003f --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/.yas-parents | |||
| @@ -0,0 +1 @@ | |||
| prog-mode | |||
diff --git a/.emacs.d/snippets/python-mode.statnett/.yas-setup.el b/.emacs.d/snippets/python-mode.statnett/.yas-setup.el new file mode 100644 index 0000000..7603e4d --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/.yas-setup.el | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | (require 'yasnippet) | ||
| 2 | (defvar yas-text) | ||
| 3 | |||
| 4 | (defun python-split-args (arg-string) | ||
| 5 | "Split a python argument string into ((name, default)..) tuples" | ||
| 6 | (mapcar (lambda (x) | ||
| 7 | (split-string x "[[:blank:]]*=[[:blank:]]*" t)) | ||
| 8 | (split-string arg-string "[[:blank:]]*,[[:blank:]]*" t))) | ||
| 9 | |||
| 10 | (defun python-args-to-docstring () | ||
| 11 | "return docstring format for the python arguments in yas-text" | ||
| 12 | (let* ((indent (concat "\n" (make-string (current-column) 32))) | ||
| 13 | (args (python-split-args yas-text)) | ||
| 14 | (max-len (if args (apply 'max (mapcar (lambda (x) (length (nth 0 x))) args)) 0)) | ||
| 15 | (formatted-args (mapconcat | ||
| 16 | (lambda (x) | ||
| 17 | (concat ":param " (nth 0 x) ":\n:type " (nth 0 x) ":\n" | ||
| 18 | (if (nth 1 x) (concat "\(default " (nth 1 x) "\)")))) | ||
| 19 | args | ||
| 20 | indent))) | ||
| 21 | (unless (string= formatted-args "") | ||
| 22 | (mapconcat 'identity (list "Keyword Arguments:" formatted-args) indent)))) | ||
| 23 | |||
| 24 | (add-hook 'python-mode-hook | ||
| 25 | '(lambda () (set (make-local-variable 'yas-indent-line) 'fixed))) | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/assert b/.emacs.d/snippets/python-mode.statnett/assert new file mode 100644 index 0000000..ec82efe --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/assert | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: assert | ||
| 3 | # key: ass | ||
| 4 | # group: testing | ||
| 5 | # -- | ||
| 6 | assert $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/bang b/.emacs.d/snippets/python-mode.statnett/bang new file mode 100644 index 0000000..d70a4a2 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/bang | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: #! | ||
| 3 | # key: #! | ||
| 4 | # contributor : @avelino | ||
| 5 | # -- | ||
| 6 | #!/usr/bin/env python \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/classmethod b/.emacs.d/snippets/python-mode.statnett/classmethod new file mode 100644 index 0000000..aa78440 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/classmethod | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: classmethod | ||
| 3 | # key: cm | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | @classmethod | ||
| 7 | def ${1:meth}(cls, $2): | ||
| 8 | """ | ||
| 9 | """ | ||
| 10 | $3 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/cls b/.emacs.d/snippets/python-mode.statnett/cls new file mode 100644 index 0000000..3dbd391 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/cls | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: cls | ||
| 3 | # key: cls | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | class ${1:class}(${2:object}): | ||
| 7 | """""" | ||
| 8 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/dec b/.emacs.d/snippets/python-mode.statnett/dec new file mode 100644 index 0000000..b22c9e9 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/dec | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: dec | ||
| 3 | # key: dec | ||
| 4 | # group : definitions | ||
| 5 | # -- | ||
| 6 | def ${1:decorator}(func): | ||
| 7 | $2 | ||
| 8 | def _$1(*args, **kwargs): | ||
| 9 | $3 | ||
| 10 | ret = func(*args, **kwargs) | ||
| 11 | $4 | ||
| 12 | return ret | ||
| 13 | |||
| 14 | return _$1 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/doc b/.emacs.d/snippets/python-mode.statnett/doc new file mode 100644 index 0000000..a7d924a --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/doc | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: doc | ||
| 3 | # key: d | ||
| 4 | # -- | ||
| 5 | """$0 | ||
| 6 | """ | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/docstring_oneliner b/.emacs.d/snippets/python-mode.statnett/docstring_oneliner new file mode 100644 index 0000000..8593dd6 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/docstring_oneliner | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: docstring_oneliner | ||
| 3 | # key: do | ||
| 4 | # -- | ||
| 5 | """$0""" \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/docstring_param b/.emacs.d/snippets/python-mode.statnett/docstring_param new file mode 100644 index 0000000..aa8b880 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/docstring_param | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: docstring_param | ||
| 3 | # key: P | ||
| 4 | # -- | ||
| 5 | :param $1: $0 | ||
| 6 | :type $1: \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/docstring_return b/.emacs.d/snippets/python-mode.statnett/docstring_return new file mode 100644 index 0000000..4bf2f16 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/docstring_return | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: docstring_return | ||
| 3 | # key: R | ||
| 4 | # -- | ||
| 5 | :return: $0 | ||
| 6 | :rtype: \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/dunder b/.emacs.d/snippets/python-mode.statnett/dunder new file mode 100644 index 0000000..7c97482 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/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.statnett/enc b/.emacs.d/snippets/python-mode.statnett/enc new file mode 100644 index 0000000..e268ea3 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/enc | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: enc | ||
| 3 | # key: enc | ||
| 4 | # -- | ||
| 5 | # -*- coding: utf-8 -*- | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/false b/.emacs.d/snippets/python-mode.statnett/false new file mode 100644 index 0000000..f7f7b02 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/false | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: False | ||
| 3 | # key: f | ||
| 4 | # -- | ||
| 5 | False$0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/for b/.emacs.d/snippets/python-mode.statnett/for new file mode 100644 index 0000000..47ab339 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/for | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: for ... in ... : ... | ||
| 3 | # key: for | ||
| 4 | # group : control structure | ||
| 5 | # -- | ||
| 6 | for ${var} in ${collection}: | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/format b/.emacs.d/snippets/python-mode.statnett/format new file mode 100644 index 0000000..85c2d6f --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/format | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: format | ||
| 3 | # key: sf | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | .format($0) \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/from b/.emacs.d/snippets/python-mode.statnett/from new file mode 100644 index 0000000..3a4acfc --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/from | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: from | ||
| 3 | # key: from | ||
| 4 | # group : general | ||
| 5 | # -- | ||
| 6 | from ${1:lib} import ${2:funs} \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/function b/.emacs.d/snippets/python-mode.statnett/function new file mode 100644 index 0000000..5a39d8f --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/function | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: function | ||
| 3 | # key: fn | ||
| 4 | # group: definitions | ||
| 5 | # -- | ||
| 6 | def ${1:fun}(${2:args}): | ||
| 7 | """""" | ||
| 8 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/function_docstring b/.emacs.d/snippets/python-mode.statnett/function_docstring new file mode 100644 index 0000000..685eaf5 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/function_docstring | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: function_docstring | ||
| 3 | # key: fd | ||
| 4 | # group: definitions | ||
| 5 | # NOTE: Use minimum indentation, because Emacs 25+ doesn't dedent docstrings. | ||
| 6 | # -- | ||
| 7 | def ${1:name}($2): | ||
| 8 | \"\"\"$3 | ||
| 9 | ${2:$(python-args-to-docstring)} | ||
| 10 | \"\"\" | ||
| 11 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/ife b/.emacs.d/snippets/python-mode.statnett/ife new file mode 100644 index 0000000..4b8f613 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/ife | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: ife | ||
| 3 | # key: ife | ||
| 4 | # group : control structure | ||
| 5 | # -- | ||
| 6 | if $1: | ||
| 7 | $2 | ||
| 8 | else: | ||
| 9 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/ifmain b/.emacs.d/snippets/python-mode.statnett/ifmain new file mode 100644 index 0000000..45f2fe2 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/ifmain | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: ifmain | ||
| 3 | # key: ifm | ||
| 4 | # -- | ||
| 5 | if __name__ == "__main__": | ||
| 6 | ${1:main()} \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/import b/.emacs.d/snippets/python-mode.statnett/import new file mode 100644 index 0000000..f34bc39 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/import | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: import | ||
| 3 | # key: imp | ||
| 4 | # group : general | ||
| 5 | # -- | ||
| 6 | import ${1:lib}${2: as ${3:alias}} | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/init_docstring b/.emacs.d/snippets/python-mode.statnett/init_docstring new file mode 100644 index 0000000..51af8db --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/init_docstring | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: init_docstring | ||
| 3 | # key: id | ||
| 4 | # group : definitions | ||
| 5 | # -- | ||
| 6 | def __init__(self$1): | ||
| 7 | \"\"\"$2 | ||
| 8 | ${1:$(python-args-to-docstring)} | ||
| 9 | \"\"\" | ||
| 10 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/lambda b/.emacs.d/snippets/python-mode.statnett/lambda new file mode 100644 index 0000000..08b268b --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/lambda | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: lambda | ||
| 3 | # key: lam | ||
| 4 | # -- | ||
| 5 | lambda ${1:x}: $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/list b/.emacs.d/snippets/python-mode.statnett/list new file mode 100644 index 0000000..63cef24 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/list | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: list | ||
| 3 | # key: li | ||
| 4 | # group : definitions | ||
| 5 | # -- | ||
| 6 | [${1:el} for $1 in ${2:list}] | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/method b/.emacs.d/snippets/python-mode.statnett/method new file mode 100644 index 0000000..985ef0c --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/method | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: method | ||
| 3 | # key: m | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | def ${1:method}(self${2:, $3}): | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/method_docstring b/.emacs.d/snippets/python-mode.statnett/method_docstring new file mode 100644 index 0000000..8f5e78d --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/method_docstring | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: method_docstring | ||
| 3 | # key: md | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | def ${1:name}(self$2): | ||
| 7 | \"\"\"$3 | ||
| 8 | ${2:$(python-args-to-docstring)} | ||
| 9 | \"\"\" | ||
| 10 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/none b/.emacs.d/snippets/python-mode.statnett/none new file mode 100644 index 0000000..751278f --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/none | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: None | ||
| 3 | # key: N | ||
| 4 | # -- | ||
| 5 | None$0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/not_impl b/.emacs.d/snippets/python-mode.statnett/not_impl new file mode 100644 index 0000000..515e353 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/not_impl | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: not_impl | ||
| 3 | # key: not_impl | ||
| 4 | # -- | ||
| 5 | raise NotImplementedError \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/pass b/.emacs.d/snippets/python-mode.statnett/pass new file mode 100644 index 0000000..4734f7f --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/pass | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: pass | ||
| 3 | # key: ps | ||
| 4 | # -- | ||
| 5 | pass \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/print b/.emacs.d/snippets/python-mode.statnett/print new file mode 100644 index 0000000..9ae2ac3 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/print | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: print | ||
| 3 | # key: p | ||
| 4 | # -- | ||
| 5 | print("$0") \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/printf b/.emacs.d/snippets/python-mode.statnett/printf new file mode 100644 index 0000000..c69d6da --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/printf | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: printf | ||
| 3 | # key: pf | ||
| 4 | # -- | ||
| 5 | print("$0{}".format()) \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/property b/.emacs.d/snippets/python-mode.statnett/property new file mode 100644 index 0000000..92a296e --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/property | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: property | ||
| 3 | # key: @ | ||
| 4 | # group : code_generation | ||
| 5 | # -- | ||
| 6 | @property | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/property_getter b/.emacs.d/snippets/python-mode.statnett/property_getter new file mode 100644 index 0000000..8bb99dd --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/property_getter | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: property_getter | ||
| 3 | # key: pg | ||
| 4 | # group : code_generation | ||
| 5 | # -- | ||
| 6 | @property | ||
| 7 | def ${1:name}(self): | ||
| 8 | """$1-property""" | ||
| 9 | return self.${2:value} | ||
| 10 | |||
| 11 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/property_setter b/.emacs.d/snippets/python-mode.statnett/property_setter new file mode 100644 index 0000000..a74be67 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/property_setter | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: property_setter | ||
| 3 | # key: ps | ||
| 4 | # group : code_generation | ||
| 5 | # -- | ||
| 6 | @property | ||
| 7 | def ${1:name}(self): | ||
| 8 | """$1-property""" | ||
| 9 | return self.${2:value} | ||
| 10 | |||
| 11 | @$1.setter | ||
| 12 | def $1(self, value): | ||
| 13 | """$1-property setter""" | ||
| 14 | self.$2 = value | ||
| 15 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/repr b/.emacs.d/snippets/python-mode.statnett/repr new file mode 100644 index 0000000..a1f6783 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/repr | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: __repr__ | ||
| 3 | # key: repr | ||
| 4 | # group: dunder methods | ||
| 5 | # -- | ||
| 6 | def __repr__(self): | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/return b/.emacs.d/snippets/python-mode.statnett/return new file mode 100644 index 0000000..641a308 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/return | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: return | ||
| 3 | # key: r | ||
| 4 | # -- | ||
| 5 | return $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/scls b/.emacs.d/snippets/python-mode.statnett/scls new file mode 100644 index 0000000..4a10e28 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/scls | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: subclass | ||
| 3 | # key: scls | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | class ${1:class}(${2:super-class}): | ||
| 7 | $0 | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/script b/.emacs.d/snippets/python-mode.statnett/script new file mode 100644 index 0000000..3246334 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/script | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: script | ||
| 3 | # key: script | ||
| 4 | # -- | ||
| 5 | #!/usr/bin/env python | ||
| 6 | |||
| 7 | |||
| 8 | def main(inargs=None): | ||
| 9 | """main entry point""" | ||
| 10 | $0 | ||
| 11 | |||
| 12 | |||
| 13 | if __name__ == "__main__": | ||
| 14 | main() | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/self b/.emacs.d/snippets/python-mode.statnett/self new file mode 100644 index 0000000..4461022 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/self | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: self | ||
| 3 | # key: . | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | self.$0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/self_without_dot b/.emacs.d/snippets/python-mode.statnett/self_without_dot new file mode 100644 index 0000000..a1a0526 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/self_without_dot | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: self_without_dot | ||
| 3 | # key: s | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | self \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/selfassign b/.emacs.d/snippets/python-mode.statnett/selfassign new file mode 100644 index 0000000..95d7b2b --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/selfassign | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: selfassign | ||
| 3 | # key: sn | ||
| 4 | # group: object oriented | ||
| 5 | # -- | ||
| 6 | self.$1 = $1 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/static b/.emacs.d/snippets/python-mode.statnett/static new file mode 100644 index 0000000..19c3df9 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/static | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: static | ||
| 3 | # key: sm | ||
| 4 | # -- | ||
| 5 | @staticmethod | ||
| 6 | def ${1:func}($0): | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/str b/.emacs.d/snippets/python-mode.statnett/str new file mode 100644 index 0000000..b0572e3 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/str | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: __str__ | ||
| 3 | # key: str | ||
| 4 | # group: dunder methods | ||
| 5 | # -- | ||
| 6 | def __str__(self): | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/true b/.emacs.d/snippets/python-mode.statnett/true new file mode 100644 index 0000000..096dc9e --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/true | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: True | ||
| 3 | # key: t | ||
| 4 | # -- | ||
| 5 | True$0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/try b/.emacs.d/snippets/python-mode.statnett/try new file mode 100644 index 0000000..6e68e8d --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/try | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: try | ||
| 3 | # key: try | ||
| 4 | # -- | ||
| 5 | try: | ||
| 6 | $1 | ||
| 7 | except ${2:Exception} as e: | ||
| 8 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/while b/.emacs.d/snippets/python-mode.statnett/while new file mode 100644 index 0000000..7b3539c --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/while | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: while | ||
| 3 | # key: wh | ||
| 4 | # group: control structure | ||
| 5 | # -- | ||
| 6 | while ${1:True}: | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode.statnett/with b/.emacs.d/snippets/python-mode.statnett/with new file mode 100644 index 0000000..7fcbd38 --- /dev/null +++ b/.emacs.d/snippets/python-mode.statnett/with | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: with | ||
| 3 | # key: with | ||
| 4 | # group : control structure | ||
| 5 | # -- | ||
| 6 | with ${1:expr}${2: as ${3:alias}}: | ||
| 7 | $0 \ No newline at end of file | ||
diff --git a/.emacs.d/snippets/python-mode/parser b/.emacs.d/snippets/python-mode/parser deleted file mode 100644 index 29a04ea..0000000 --- a/.emacs.d/snippets/python-mode/parser +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | # -*- mode: snippet -*- | ||
| 2 | # name: parser | ||
| 3 | # key: pars | ||
| 4 | # group: argparser | ||
| 5 | # -- | ||
| 6 | parser = argparse.ArgumentParser(description='$1') | ||
| 7 | $0 \ No newline at end of file | ||
