summaryrefslogtreecommitdiff
path: root/snippets/python-mode
diff options
context:
space:
mode:
Diffstat (limited to 'snippets/python-mode')
-rw-r--r--snippets/python-mode/defaultdict2
-rw-r--r--snippets/python-mode/docopt2
-rw-r--r--snippets/python-mode/docopt-args2
-rw-r--r--snippets/python-mode/examples-header2
-rw-r--r--snippets/python-mode/figax2
-rw-r--r--snippets/python-mode/figaxs2
-rw-r--r--snippets/python-mode/h5py2
-rw-r--r--snippets/python-mode/mock2
-rw-r--r--snippets/python-mode/mpi4py2
-rw-r--r--snippets/python-mode/numpy-random-seed2
-rw-r--r--snippets/python-mode/numpy-testing2
-rw-r--r--snippets/python-mode/ordereddict7
-rw-r--r--snippets/python-mode/pandas2
-rw-r--r--snippets/python-mode/pandas-hdf-store6
-rw-r--r--snippets/python-mode/parameters-header2
-rw-r--r--snippets/python-mode/pdb-set-trace2
-rw-r--r--snippets/python-mode/plotting-imports2
-rw-r--r--snippets/python-mode/pprint2
-rw-r--r--snippets/python-mode/pymc2
-rw-r--r--snippets/python-mode/pymc-file2
-rw-r--r--snippets/python-mode/pyplot2
-rw-r--r--snippets/python-mode/pytest2
-rw-r--r--snippets/python-mode/python-shebang2
-rw-r--r--snippets/python-mode/returns-header2
-rw-r--r--snippets/python-mode/seaborn2
-rw-r--r--snippets/python-mode/theano2
-rw-r--r--snippets/python-mode/try-argv10
27 files changed, 47 insertions, 24 deletions
diff --git a/snippets/python-mode/defaultdict b/snippets/python-mode/defaultdict
index 3633383..35a381c 100644
--- a/snippets/python-mode/defaultdict
+++ b/snippets/python-mode/defaultdict
@@ -4,4 +4,4 @@
# group: imports
# --
from collections import defaultdict
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/docopt b/snippets/python-mode/docopt
index 33bed9f..71e98ed 100644
--- a/snippets/python-mode/docopt
+++ b/snippets/python-mode/docopt
@@ -3,4 +3,4 @@
# group: imports
# --
from docopt import docopt
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/docopt-args b/snippets/python-mode/docopt-args
index c9f2e98..0743633 100644
--- a/snippets/python-mode/docopt-args
+++ b/snippets/python-mode/docopt-args
@@ -3,4 +3,4 @@
# key: da
# --
args = docopt(__doc__)
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/examples-header b/snippets/python-mode/examples-header
index 581b1dc..339a1be 100644
--- a/snippets/python-mode/examples-header
+++ b/snippets/python-mode/examples-header
@@ -4,4 +4,4 @@
# --
Examples
--------
-$0
+ $0 \ No newline at end of file
diff --git a/snippets/python-mode/figax b/snippets/python-mode/figax
index 2e149bc..65d4ce8 100644
--- a/snippets/python-mode/figax
+++ b/snippets/python-mode/figax
@@ -3,4 +3,4 @@
# key: fax
# --
fig, ax = plt.subplots()
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/figaxs b/snippets/python-mode/figaxs
index a9117ca..7e99635 100644
--- a/snippets/python-mode/figaxs
+++ b/snippets/python-mode/figaxs
@@ -2,4 +2,4 @@
# name: figaxs
# key: faxs
# --
-fig, axs = plt.subplots($0)
+fig, axs = plt.subplots($0) \ No newline at end of file
diff --git a/snippets/python-mode/h5py b/snippets/python-mode/h5py
index 6bea2df..3eb0ceb 100644
--- a/snippets/python-mode/h5py
+++ b/snippets/python-mode/h5py
@@ -4,4 +4,4 @@
# group: imports
# --
import h5py
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/mock b/snippets/python-mode/mock
index 5c122aa..5d8d1f8 100644
--- a/snippets/python-mode/mock
+++ b/snippets/python-mode/mock
@@ -3,4 +3,4 @@
# group: imports
# --
from unittest import mock
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/mpi4py b/snippets/python-mode/mpi4py
index 80bd6b3..6b77ddc 100644
--- a/snippets/python-mode/mpi4py
+++ b/snippets/python-mode/mpi4py
@@ -4,4 +4,4 @@
# group: imports
# --
from mpi4py import MPI
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/numpy-random-seed b/snippets/python-mode/numpy-random-seed
index 6022be3..b8db465 100644
--- a/snippets/python-mode/numpy-random-seed
+++ b/snippets/python-mode/numpy-random-seed
@@ -3,4 +3,4 @@
# key: nrs
# --
np.random.seed(`(random 4294967295)`)
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/numpy-testing b/snippets/python-mode/numpy-testing
index fbfb238..c84868d 100644
--- a/snippets/python-mode/numpy-testing
+++ b/snippets/python-mode/numpy-testing
@@ -4,4 +4,4 @@
# group: imports
# --
import numpy.testing as npt
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/ordereddict b/snippets/python-mode/ordereddict
new file mode 100644
index 0000000..e49e377
--- /dev/null
+++ b/snippets/python-mode/ordereddict
@@ -0,0 +1,7 @@
+# -*- mode: snippet -*-
+# name: ordereddict
+# key: od
+# group: imports
+# --
+from collections import OrderedDict
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/pandas b/snippets/python-mode/pandas
index b20e0dd..7239528 100644
--- a/snippets/python-mode/pandas
+++ b/snippets/python-mode/pandas
@@ -4,4 +4,4 @@
# group: imports
# --
import pandas as pd
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/pandas-hdf-store b/snippets/python-mode/pandas-hdf-store
new file mode 100644
index 0000000..a19ab13
--- /dev/null
+++ b/snippets/python-mode/pandas-hdf-store
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: Pandas HDF5 store
+# key: pdhs
+# --
+with pd.HDFStore($1) as store:
+ $0 \ No newline at end of file
diff --git a/snippets/python-mode/parameters-header b/snippets/python-mode/parameters-header
index 74311d1..90d26ca 100644
--- a/snippets/python-mode/parameters-header
+++ b/snippets/python-mode/parameters-header
@@ -4,4 +4,4 @@
# --
Parameters
----------
-$0
+ $0 \ No newline at end of file
diff --git a/snippets/python-mode/pdb-set-trace b/snippets/python-mode/pdb-set-trace
index 6f41e0e..c4cb5de 100644
--- a/snippets/python-mode/pdb-set-trace
+++ b/snippets/python-mode/pdb-set-trace
@@ -1,4 +1,4 @@
# -*- mode: snippet -*-
# key: pst
# --
-import pdb; pdb.set_trace()$0
+import pdb; pdb.set_trace()$0 \ No newline at end of file
diff --git a/snippets/python-mode/plotting-imports b/snippets/python-mode/plotting-imports
index 46b986d..2900948 100644
--- a/snippets/python-mode/plotting-imports
+++ b/snippets/python-mode/plotting-imports
@@ -6,4 +6,4 @@
import matplotlib.pyplot as plt
import mplutil
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/pprint b/snippets/python-mode/pprint
index cb8a7a6..0c09793 100644
--- a/snippets/python-mode/pprint
+++ b/snippets/python-mode/pprint
@@ -4,4 +4,4 @@
# group: imports
# --
from pprint import pprint
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/pymc b/snippets/python-mode/pymc
index 1fc9900..9bcd56c 100644
--- a/snippets/python-mode/pymc
+++ b/snippets/python-mode/pymc
@@ -3,4 +3,4 @@
# group: imports
# --
import pymc3 as pm
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/pymc-file b/snippets/python-mode/pymc-file
index 0425445..1cae0cd 100644
--- a/snippets/python-mode/pymc-file
+++ b/snippets/python-mode/pymc-file
@@ -13,4 +13,4 @@ if __name__ == '__main__':
start = {}
trace = pm.sample(1000,
step=pm.NUTS(model.vars),
- start=start)
+ start=start) \ No newline at end of file
diff --git a/snippets/python-mode/pyplot b/snippets/python-mode/pyplot
index 24f541b..608b77f 100644
--- a/snippets/python-mode/pyplot
+++ b/snippets/python-mode/pyplot
@@ -4,4 +4,4 @@
# group: imports
# --
import matplotlib.pyplot as plt
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/pytest b/snippets/python-mode/pytest
index 0f5a0ab..e81d0a9 100644
--- a/snippets/python-mode/pytest
+++ b/snippets/python-mode/pytest
@@ -4,4 +4,4 @@
# group: imports
# --
import pytest
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/python-shebang b/snippets/python-mode/python-shebang
index 3d4d9a3..fdacfed 100644
--- a/snippets/python-mode/python-shebang
+++ b/snippets/python-mode/python-shebang
@@ -3,4 +3,4 @@
# key: sb
# --
#!/usr/bin/env python${1:3}
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/returns-header b/snippets/python-mode/returns-header
index 713f69b..b84bb21 100644
--- a/snippets/python-mode/returns-header
+++ b/snippets/python-mode/returns-header
@@ -4,4 +4,4 @@
# --
Returns
-------
-$0
+ $0 \ No newline at end of file
diff --git a/snippets/python-mode/seaborn b/snippets/python-mode/seaborn
index 14710e8..bfa54da 100644
--- a/snippets/python-mode/seaborn
+++ b/snippets/python-mode/seaborn
@@ -4,4 +4,4 @@
# group: imports
# --
import seaborn as sns
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/theano b/snippets/python-mode/theano
index f7d31c9..c3a3375 100644
--- a/snippets/python-mode/theano
+++ b/snippets/python-mode/theano
@@ -4,4 +4,4 @@
# group: imports
# --
import theano.tensor as tn
-$0
+$0 \ No newline at end of file
diff --git a/snippets/python-mode/try-argv b/snippets/python-mode/try-argv
new file mode 100644
index 0000000..5b515ad
--- /dev/null
+++ b/snippets/python-mode/try-argv
@@ -0,0 +1,10 @@
+# -*- mode: snippet -*-
+# name: try argv
+# key: targv
+# --
+try:
+ _, $1 = sys.argv
+except ValueError:
+ sys.exit(__doc__)
+
+$0 \ No newline at end of file