summaryrefslogtreecommitdiff
path: root/snippets/python-mode
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-03-24 22:36:59 -0400
committerKyle Meyer <kyle@kyleam.com>2014-03-24 22:38:28 -0400
commitbb0ba4fcb45bc08409657e05e7951a364f6a2e53 (patch)
tree7e06155f7b0ed9bd51b276c821462794bca36e4e /snippets/python-mode
parentd3499573ef817ce737f924f4641dade14e6233fd (diff)
downloademacs.d-bb0ba4fcb45bc08409657e05e7951a364f6a2e53.tar.gz
Reorganize and add Python snippets
Diffstat (limited to 'snippets/python-mode')
-rw-r--r--snippets/python-mode/dat6
-rw-r--r--snippets/python-mode/docopt6
-rw-r--r--snippets/python-mode/docopt-args6
-rw-r--r--snippets/python-mode/mock6
-rw-r--r--snippets/python-mode/numpy-random-seed6
-rw-r--r--snippets/python-mode/numpy-testing7
-rw-r--r--snippets/python-mode/pandas7
-rw-r--r--snippets/python-mode/plotting-imports9
-rw-r--r--snippets/python-mode/plt7
-rw-r--r--snippets/python-mode/pprint7
-rw-r--r--snippets/python-mode/pymc6
-rw-r--r--snippets/python-mode/pymc-file (renamed from snippets/python-mode/pm)7
-rw-r--r--snippets/python-mode/pyplot7
-rw-r--r--snippets/python-mode/pytest7
-rw-r--r--snippets/python-mode/pytest-def7
-rw-r--r--snippets/python-mode/python-shebang6
-rw-r--r--snippets/python-mode/shebang5
-rw-r--r--snippets/python-mode/test-method8
-rw-r--r--snippets/python-mode/testfunc6
-rw-r--r--snippets/python-mode/theano7
20 files changed, 105 insertions, 28 deletions
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/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/pm b/snippets/python-mode/pymc-file
index c5fb977..65087a8 100644
--- a/snippets/python-mode/pm
+++ b/snippets/python-mode/pymc-file
@@ -1,8 +1,7 @@
-# name: pymc
-# key: pm
-# expand-env: ((yas/indent-line 'fixed))
+# -*- mode: snippet -*-
+# name: pymc file
+# key: pmf
# --
-import theano.tensor as tn
import pymc as pm
with pm.Model() as model:
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