From bb0ba4fcb45bc08409657e05e7951a364f6a2e53 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 24 Mar 2014 22:36:59 -0400 Subject: Reorganize and add Python snippets --- snippets/python-mode/dat | 6 ------ snippets/python-mode/docopt | 6 ++++++ snippets/python-mode/docopt-args | 6 ++++++ snippets/python-mode/mock | 6 ++++++ snippets/python-mode/numpy-random-seed | 6 ++++++ snippets/python-mode/numpy-testing | 7 +++++++ snippets/python-mode/pandas | 7 +++++++ snippets/python-mode/plotting-imports | 9 +++++++++ snippets/python-mode/plt | 7 ------- snippets/python-mode/pm | 16 ---------------- snippets/python-mode/pprint | 7 +++++++ snippets/python-mode/pymc | 6 ++++++ snippets/python-mode/pymc-file | 15 +++++++++++++++ snippets/python-mode/pyplot | 7 +++++++ snippets/python-mode/pytest | 7 +++++++ snippets/python-mode/pytest-def | 7 +++++++ snippets/python-mode/python-shebang | 6 ++++++ snippets/python-mode/shebang | 5 ----- snippets/python-mode/test-method | 8 ++++++++ snippets/python-mode/testfunc | 6 ------ snippets/python-mode/theano | 7 +++++++ 21 files changed, 117 insertions(+), 40 deletions(-) delete mode 100644 snippets/python-mode/dat create mode 100644 snippets/python-mode/docopt create mode 100644 snippets/python-mode/docopt-args create mode 100644 snippets/python-mode/mock create mode 100644 snippets/python-mode/numpy-random-seed create mode 100644 snippets/python-mode/numpy-testing create mode 100644 snippets/python-mode/pandas create mode 100644 snippets/python-mode/plotting-imports delete mode 100644 snippets/python-mode/plt delete mode 100644 snippets/python-mode/pm create mode 100644 snippets/python-mode/pprint create mode 100644 snippets/python-mode/pymc create mode 100644 snippets/python-mode/pymc-file create mode 100644 snippets/python-mode/pyplot create mode 100644 snippets/python-mode/pytest create mode 100644 snippets/python-mode/pytest-def create mode 100644 snippets/python-mode/python-shebang delete mode 100644 snippets/python-mode/shebang create mode 100644 snippets/python-mode/test-method delete mode 100644 snippets/python-mode/testfunc create mode 100644 snippets/python-mode/theano (limited to 'snippets/python-mode') diff --git a/snippets/python-mode/dat b/snippets/python-mode/dat deleted file mode 100644 index bb96f33..0000000 --- a/snippets/python-mode/dat +++ /dev/null @@ -1,6 +0,0 @@ -# name: data analysis imports -# key: dat -# -- -import numpy as np -import pandas as pd -$0 diff --git a/snippets/python-mode/docopt b/snippets/python-mode/docopt new file mode 100644 index 0000000..33bed9f --- /dev/null +++ b/snippets/python-mode/docopt @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# key: dopt +# group: imports +# -- +from docopt import docopt +$0 diff --git a/snippets/python-mode/docopt-args b/snippets/python-mode/docopt-args new file mode 100644 index 0000000..c9f2e98 --- /dev/null +++ b/snippets/python-mode/docopt-args @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: docopt args +# key: da +# -- +args = docopt(__doc__) +$0 diff --git a/snippets/python-mode/mock b/snippets/python-mode/mock new file mode 100644 index 0000000..5c122aa --- /dev/null +++ b/snippets/python-mode/mock @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# key: mock +# group: imports +# -- +from unittest import mock +$0 diff --git a/snippets/python-mode/numpy-random-seed b/snippets/python-mode/numpy-random-seed new file mode 100644 index 0000000..1be05ec --- /dev/null +++ b/snippets/python-mode/numpy-random-seed @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: numpy random seed +# key: nrs +# -- +np.random.seed(`(random most-positive-fixnum)`) +$0 diff --git a/snippets/python-mode/numpy-testing b/snippets/python-mode/numpy-testing new file mode 100644 index 0000000..fbfb238 --- /dev/null +++ b/snippets/python-mode/numpy-testing @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: numpy testing +# key: npt +# group: imports +# -- +import numpy.testing as npt +$0 diff --git a/snippets/python-mode/pandas b/snippets/python-mode/pandas new file mode 100644 index 0000000..b20e0dd --- /dev/null +++ b/snippets/python-mode/pandas @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: pandas +# key: pd +# group: imports +# -- +import pandas as pd +$0 diff --git a/snippets/python-mode/plotting-imports b/snippets/python-mode/plotting-imports new file mode 100644 index 0000000..6d957b3 --- /dev/null +++ b/snippets/python-mode/plotting-imports @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: plotting imports +# key: plta +# group: imports +# -- +import matplotlib.pyplot as plt + +import pltaid +$0 diff --git a/snippets/python-mode/plt b/snippets/python-mode/plt deleted file mode 100644 index 7952fff..0000000 --- a/snippets/python-mode/plt +++ /dev/null @@ -1,7 +0,0 @@ -# name: matplotlib-related import -# key: plt -# -- -import matplotlib.pyplot as plt - -import pltaid -$0 diff --git a/snippets/python-mode/pm b/snippets/python-mode/pm deleted file mode 100644 index c5fb977..0000000 --- a/snippets/python-mode/pm +++ /dev/null @@ -1,16 +0,0 @@ -# name: pymc -# key: pm -# expand-env: ((yas/indent-line 'fixed)) -# -- -import theano.tensor as tn -import pymc as pm - -with pm.Model() as model: - $0 - -if __name__ == '__main__': - with model: - start = {} - trace = pm.sample(1000, - step=pm.NUTS(model.vars), - start=start) diff --git a/snippets/python-mode/pprint b/snippets/python-mode/pprint new file mode 100644 index 0000000..cb8a7a6 --- /dev/null +++ b/snippets/python-mode/pprint @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: pprint +# key: pp +# group: imports +# -- +from pprint import pprint +$0 diff --git a/snippets/python-mode/pymc b/snippets/python-mode/pymc new file mode 100644 index 0000000..c4a6a62 --- /dev/null +++ b/snippets/python-mode/pymc @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# key: pm +# group: imports +# -- +import pymc as pm +$0 diff --git a/snippets/python-mode/pymc-file b/snippets/python-mode/pymc-file new file mode 100644 index 0000000..65087a8 --- /dev/null +++ b/snippets/python-mode/pymc-file @@ -0,0 +1,15 @@ +# -*- mode: snippet -*- +# name: pymc file +# key: pmf +# -- +import pymc as pm + +with pm.Model() as model: + $0 + +if __name__ == '__main__': + with model: + start = {} + trace = pm.sample(1000, + step=pm.NUTS(model.vars), + start=start) diff --git a/snippets/python-mode/pyplot b/snippets/python-mode/pyplot new file mode 100644 index 0000000..24f541b --- /dev/null +++ b/snippets/python-mode/pyplot @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: pyplot +# key: plt +# group: imports +# -- +import matplotlib.pyplot as plt +$0 diff --git a/snippets/python-mode/pytest b/snippets/python-mode/pytest new file mode 100644 index 0000000..0f5a0ab --- /dev/null +++ b/snippets/python-mode/pytest @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: pytest +# key: pt +# group: imports +# -- +import pytest +$0 diff --git a/snippets/python-mode/pytest-def b/snippets/python-mode/pytest-def new file mode 100644 index 0000000..682b009 --- /dev/null +++ b/snippets/python-mode/pytest-def @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: pytest def +# key: td +# group: testing +# -- +def test_${1:name}($2): + $0 \ No newline at end of file diff --git a/snippets/python-mode/python-shebang b/snippets/python-mode/python-shebang new file mode 100644 index 0000000..3d4d9a3 --- /dev/null +++ b/snippets/python-mode/python-shebang @@ -0,0 +1,6 @@ +# -*- mode: snippet -*- +# name: Python shebang +# key: sb +# -- +#!/usr/bin/env python${1:3} +$0 diff --git a/snippets/python-mode/shebang b/snippets/python-mode/shebang deleted file mode 100644 index 1506808..0000000 --- a/snippets/python-mode/shebang +++ /dev/null @@ -1,5 +0,0 @@ -# name: python shebang -# key: sb -# -- -#!/usr/bin/env python${1:3} -$0 diff --git a/snippets/python-mode/test-method b/snippets/python-mode/test-method new file mode 100644 index 0000000..e0e1be9 --- /dev/null +++ b/snippets/python-mode/test-method @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: test method +# key: tm +# group: testing +# Copied from builtin deftest and given new key. +# -- +def test_${1:long_name}(self): + $0 \ No newline at end of file diff --git a/snippets/python-mode/testfunc b/snippets/python-mode/testfunc deleted file mode 100644 index efa4ca3..0000000 --- a/snippets/python-mode/testfunc +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# name: pytest test definition -# key: deft -# -- -def test_${1:name}($2): - $0 \ No newline at end of file diff --git a/snippets/python-mode/theano b/snippets/python-mode/theano new file mode 100644 index 0000000..f7d31c9 --- /dev/null +++ b/snippets/python-mode/theano @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: theano +# key: tn +# group: imports +# -- +import theano.tensor as tn +$0 -- cgit v1.2.3