From 4996a6403108a226d4ff1d73b880207cc80284bd Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 12 Jan 2021 20:05:37 +0100 Subject: Add snippets/python-mode.statnett --- .../snippets/python-mode.statnett/.yas-parents | 1 + .../snippets/python-mode.statnett/.yas-setup.el | 25 ++++++++++++++++++++++ .emacs.d/snippets/python-mode.statnett/assert | 6 ++++++ .emacs.d/snippets/python-mode.statnett/bang | 6 ++++++ .emacs.d/snippets/python-mode.statnett/classmethod | 10 +++++++++ .emacs.d/snippets/python-mode.statnett/cls | 8 +++++++ .emacs.d/snippets/python-mode.statnett/dec | 14 ++++++++++++ .emacs.d/snippets/python-mode.statnett/doc | 6 ++++++ .../python-mode.statnett/docstring_oneliner | 5 +++++ .../snippets/python-mode.statnett/docstring_param | 6 ++++++ .../snippets/python-mode.statnett/docstring_return | 6 ++++++ .emacs.d/snippets/python-mode.statnett/dunder | 5 +++++ .emacs.d/snippets/python-mode.statnett/enc | 5 +++++ .emacs.d/snippets/python-mode.statnett/false | 5 +++++ .emacs.d/snippets/python-mode.statnett/for | 7 ++++++ .emacs.d/snippets/python-mode.statnett/format | 6 ++++++ .emacs.d/snippets/python-mode.statnett/from | 6 ++++++ .emacs.d/snippets/python-mode.statnett/function | 8 +++++++ .../python-mode.statnett/function_docstring | 11 ++++++++++ .emacs.d/snippets/python-mode.statnett/ife | 9 ++++++++ .emacs.d/snippets/python-mode.statnett/ifmain | 6 ++++++ .emacs.d/snippets/python-mode.statnett/import | 7 ++++++ .../snippets/python-mode.statnett/init_docstring | 10 +++++++++ .emacs.d/snippets/python-mode.statnett/lambda | 5 +++++ .emacs.d/snippets/python-mode.statnett/list | 7 ++++++ .emacs.d/snippets/python-mode.statnett/method | 7 ++++++ .../snippets/python-mode.statnett/method_docstring | 10 +++++++++ .emacs.d/snippets/python-mode.statnett/none | 5 +++++ .emacs.d/snippets/python-mode.statnett/not_impl | 5 +++++ .emacs.d/snippets/python-mode.statnett/pass | 5 +++++ .emacs.d/snippets/python-mode.statnett/print | 5 +++++ .emacs.d/snippets/python-mode.statnett/printf | 5 +++++ .emacs.d/snippets/python-mode.statnett/property | 7 ++++++ .../snippets/python-mode.statnett/property_getter | 11 ++++++++++ .../snippets/python-mode.statnett/property_setter | 15 +++++++++++++ .emacs.d/snippets/python-mode.statnett/repr | 7 ++++++ .emacs.d/snippets/python-mode.statnett/return | 5 +++++ .emacs.d/snippets/python-mode.statnett/scls | 7 ++++++ .emacs.d/snippets/python-mode.statnett/script | 14 ++++++++++++ .emacs.d/snippets/python-mode.statnett/self | 6 ++++++ .../snippets/python-mode.statnett/self_without_dot | 6 ++++++ .emacs.d/snippets/python-mode.statnett/selfassign | 6 ++++++ .emacs.d/snippets/python-mode.statnett/static | 6 ++++++ .emacs.d/snippets/python-mode.statnett/str | 7 ++++++ .emacs.d/snippets/python-mode.statnett/true | 5 +++++ .emacs.d/snippets/python-mode.statnett/try | 8 +++++++ .emacs.d/snippets/python-mode.statnett/while | 7 ++++++ .emacs.d/snippets/python-mode.statnett/with | 7 ++++++ .emacs.d/snippets/python-mode/parser | 7 ------ 49 files changed, 356 insertions(+), 7 deletions(-) create mode 100644 .emacs.d/snippets/python-mode.statnett/.yas-parents create mode 100644 .emacs.d/snippets/python-mode.statnett/.yas-setup.el create mode 100644 .emacs.d/snippets/python-mode.statnett/assert create mode 100644 .emacs.d/snippets/python-mode.statnett/bang create mode 100644 .emacs.d/snippets/python-mode.statnett/classmethod create mode 100644 .emacs.d/snippets/python-mode.statnett/cls create mode 100644 .emacs.d/snippets/python-mode.statnett/dec create mode 100644 .emacs.d/snippets/python-mode.statnett/doc create mode 100644 .emacs.d/snippets/python-mode.statnett/docstring_oneliner create mode 100644 .emacs.d/snippets/python-mode.statnett/docstring_param create mode 100644 .emacs.d/snippets/python-mode.statnett/docstring_return create mode 100644 .emacs.d/snippets/python-mode.statnett/dunder create mode 100644 .emacs.d/snippets/python-mode.statnett/enc create mode 100644 .emacs.d/snippets/python-mode.statnett/false create mode 100644 .emacs.d/snippets/python-mode.statnett/for create mode 100644 .emacs.d/snippets/python-mode.statnett/format create mode 100644 .emacs.d/snippets/python-mode.statnett/from create mode 100644 .emacs.d/snippets/python-mode.statnett/function create mode 100644 .emacs.d/snippets/python-mode.statnett/function_docstring create mode 100644 .emacs.d/snippets/python-mode.statnett/ife create mode 100644 .emacs.d/snippets/python-mode.statnett/ifmain create mode 100644 .emacs.d/snippets/python-mode.statnett/import create mode 100644 .emacs.d/snippets/python-mode.statnett/init_docstring create mode 100644 .emacs.d/snippets/python-mode.statnett/lambda create mode 100644 .emacs.d/snippets/python-mode.statnett/list create mode 100644 .emacs.d/snippets/python-mode.statnett/method create mode 100644 .emacs.d/snippets/python-mode.statnett/method_docstring create mode 100644 .emacs.d/snippets/python-mode.statnett/none create mode 100644 .emacs.d/snippets/python-mode.statnett/not_impl create mode 100644 .emacs.d/snippets/python-mode.statnett/pass create mode 100644 .emacs.d/snippets/python-mode.statnett/print create mode 100644 .emacs.d/snippets/python-mode.statnett/printf create mode 100644 .emacs.d/snippets/python-mode.statnett/property create mode 100644 .emacs.d/snippets/python-mode.statnett/property_getter create mode 100644 .emacs.d/snippets/python-mode.statnett/property_setter create mode 100644 .emacs.d/snippets/python-mode.statnett/repr create mode 100644 .emacs.d/snippets/python-mode.statnett/return create mode 100644 .emacs.d/snippets/python-mode.statnett/scls create mode 100644 .emacs.d/snippets/python-mode.statnett/script create mode 100644 .emacs.d/snippets/python-mode.statnett/self create mode 100644 .emacs.d/snippets/python-mode.statnett/self_without_dot create mode 100644 .emacs.d/snippets/python-mode.statnett/selfassign create mode 100644 .emacs.d/snippets/python-mode.statnett/static create mode 100644 .emacs.d/snippets/python-mode.statnett/str create mode 100644 .emacs.d/snippets/python-mode.statnett/true create mode 100644 .emacs.d/snippets/python-mode.statnett/try create mode 100644 .emacs.d/snippets/python-mode.statnett/while create mode 100644 .emacs.d/snippets/python-mode.statnett/with delete mode 100644 .emacs.d/snippets/python-mode/parser 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 @@ +(require 'yasnippet) +(defvar yas-text) + +(defun python-split-args (arg-string) + "Split a python argument string into ((name, default)..) tuples" + (mapcar (lambda (x) + (split-string x "[[:blank:]]*=[[:blank:]]*" t)) + (split-string arg-string "[[:blank:]]*,[[:blank:]]*" t))) + +(defun python-args-to-docstring () + "return docstring format for the python arguments in yas-text" + (let* ((indent (concat "\n" (make-string (current-column) 32))) + (args (python-split-args yas-text)) + (max-len (if args (apply 'max (mapcar (lambda (x) (length (nth 0 x))) args)) 0)) + (formatted-args (mapconcat + (lambda (x) + (concat ":param " (nth 0 x) ":\n:type " (nth 0 x) ":\n" + (if (nth 1 x) (concat "\(default " (nth 1 x) "\)")))) + args + indent))) + (unless (string= formatted-args "") + (mapconcat 'identity (list "Keyword Arguments:" formatted-args) indent)))) + +(add-hook 'python-mode-hook + '(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 @@ +# -*- mode: snippet -*- +# name: assert +# key: ass +# group: testing +# -- +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 @@ +# -*- mode: snippet -*- +# name: #! +# key: #! +# contributor : @avelino +# -- +#!/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 @@ +# -*- mode: snippet -*- +# name: classmethod +# key: cm +# group: object oriented +# -- +@classmethod +def ${1:meth}(cls, $2): + """ + """ + $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 @@ +# -*- mode: snippet -*- +# name: cls +# key: cls +# group: object oriented +# -- +class ${1:class}(${2:object}): + """""" + $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 @@ +# -*- mode: snippet -*- +# name: dec +# key: dec +# group : definitions +# -- +def ${1:decorator}(func): + $2 + def _$1(*args, **kwargs): + $3 + ret = func(*args, **kwargs) + $4 + return ret + + 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 @@ +# -*- mode: snippet -*- +# name: doc +# key: d +# -- +"""$0 +""" 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 @@ +# -*- mode: snippet -*- +# name: docstring_oneliner +# key: do +# -- +"""$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 @@ +# -*- mode: snippet -*- +# name: docstring_param +# key: P +# -- +:param $1: $0 +: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 @@ +# -*- mode: snippet -*- +# name: docstring_return +# key: R +# -- +:return: $0 +: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 @@ +# -*- mode: snippet -*- +# name: dunder +# key: dd +# -- +__${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 @@ +# -*- mode: snippet -*- +# name: enc +# key: enc +# -- +# -*- 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 @@ +# -*- mode: snippet -*- +# name: False +# key: f +# -- +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 @@ +# -*- mode: snippet -*- +# name: for ... in ... : ... +# key: for +# group : control structure +# -- +for ${var} in ${collection}: + $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 @@ +# -*- mode: snippet -*- +# name: format +# key: sf +# group: object oriented +# -- +.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 @@ +# -*- mode: snippet -*- +# name: from +# key: from +# group : general +# -- +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 @@ +# -*- mode: snippet -*- +# name: function +# key: fn +# group: definitions +# -- +def ${1:fun}(${2:args}): + """""" + $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 @@ +# -*- mode: snippet -*- +# name: function_docstring +# key: fd +# group: definitions +# NOTE: Use minimum indentation, because Emacs 25+ doesn't dedent docstrings. +# -- +def ${1:name}($2): + \"\"\"$3 + ${2:$(python-args-to-docstring)} + \"\"\" + $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 @@ +# -*- mode: snippet -*- +# name: ife +# key: ife +# group : control structure +# -- +if $1: + $2 +else: + $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 @@ +# -*- mode: snippet -*- +# name: ifmain +# key: ifm +# -- +if __name__ == "__main__": + ${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 @@ +# -*- mode: snippet -*- +# name: import +# key: imp +# group : general +# -- +import ${1:lib}${2: as ${3:alias}} +$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 @@ +# -*- mode: snippet -*- +# name: init_docstring +# key: id +# group : definitions +# -- +def __init__(self$1): + \"\"\"$2 + ${1:$(python-args-to-docstring)} + \"\"\" + $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 @@ +# -*- mode: snippet -*- +# name: lambda +# key: lam +# -- +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 @@ +# -*- mode: snippet -*- +# name: list +# key: li +# group : definitions +# -- +[${1:el} for $1 in ${2:list}] +$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 @@ +# -*- mode: snippet -*- +# name: method +# key: m +# group: object oriented +# -- +def ${1:method}(self${2:, $3}): + $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 @@ +# -*- mode: snippet -*- +# name: method_docstring +# key: md +# group: object oriented +# -- +def ${1:name}(self$2): + \"\"\"$3 + ${2:$(python-args-to-docstring)} + \"\"\" + $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 @@ +# -*- mode: snippet -*- +# name: None +# key: N +# -- +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 @@ +# -*- mode: snippet -*- +# name: not_impl +# key: not_impl +# -- +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 @@ +# -*- mode: snippet -*- +# name: pass +# key: ps +# -- +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 @@ +# -*- mode: snippet -*- +# name: print +# key: p +# -- +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 @@ +# -*- mode: snippet -*- +# name: printf +# key: pf +# -- +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 @@ +# -*- mode: snippet -*- +# name: property +# key: @ +# group : code_generation +# -- +@property +$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 @@ +# -*- mode: snippet -*- +# name: property_getter +# key: pg +# group : code_generation +# -- +@property +def ${1:name}(self): + """$1-property""" + return self.${2:value} + +$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 @@ +# -*- mode: snippet -*- +# name: property_setter +# key: ps +# group : code_generation +# -- +@property +def ${1:name}(self): + """$1-property""" + return self.${2:value} + +@$1.setter +def $1(self, value): + """$1-property setter""" + self.$2 = value +$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 @@ +# -*- mode: snippet -*- +# name: __repr__ +# key: repr +# group: dunder methods +# -- +def __repr__(self): + $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 @@ +# -*- mode: snippet -*- +# name: return +# key: r +# -- +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 @@ +# -*- mode: snippet -*- +# name: subclass +# key: scls +# group: object oriented +# -- +class ${1:class}(${2:super-class}): + $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 @@ +# -*- mode: snippet -*- +# name: script +# key: script +# -- +#!/usr/bin/env python + + +def main(inargs=None): + """main entry point""" + $0 + + +if __name__ == "__main__": + 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 @@ +# -*- mode: snippet -*- +# name: self +# key: . +# group: object oriented +# -- +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 @@ +# -*- mode: snippet -*- +# name: self_without_dot +# key: s +# group: object oriented +# -- +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 @@ +# -*- mode: snippet -*- +# name: selfassign +# key: sn +# group: object oriented +# -- +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 @@ +# -*- mode: snippet -*- +# name: static +# key: sm +# -- +@staticmethod +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 @@ +# -*- mode: snippet -*- +# name: __str__ +# key: str +# group: dunder methods +# -- +def __str__(self): + $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 @@ +# -*- mode: snippet -*- +# name: True +# key: t +# -- +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 @@ +# -*- mode: snippet -*- +# name: try +# key: try +# -- +try: + $1 +except ${2:Exception} as e: + $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 @@ +# -*- mode: snippet -*- +# name: while +# key: wh +# group: control structure +# -- +while ${1:True}: + $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 @@ +# -*- mode: snippet -*- +# name: with +# key: with +# group : control structure +# -- +with ${1:expr}${2: as ${3:alias}}: + $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 @@ -# -*- mode: snippet -*- -# name: parser -# key: pars -# group: argparser -# -- -parser = argparse.ArgumentParser(description='$1') -$0 \ No newline at end of file -- cgit v1.3