diff options
| author | Cody Hiar <codyfh@gmail.com> | 2017-03-01 04:14:06 +0000 | 
|---|---|---|
| committer | Cody Hiar <codyfh@gmail.com> | 2017-03-01 04:14:06 +0000 | 
| commit | f95311ce4de26cf2c2db14906410f55589fab0a8 (patch) | |
| tree | 1b7ace85a73b6a2f9a9b920311a660c5b6537252 /snippets/python | |
| parent | 5fcd5c3ab60bde0d43367e4243512450a2f83091 (diff) | |
Adding some snippet functionality, reduce typing
Diffstat (limited to 'snippets/python')
| -rw-r--r-- | snippets/python/cutf8.py | 2 | ||||
| -rw-r--r-- | snippets/python/fabfile.py | 33 | ||||
| -rw-r--r-- | snippets/python/pudb.py | 1 | ||||
| -rw-r--r-- | snippets/python/pyclass.py | 5 | ||||
| -rw-r--r-- | snippets/python/pydef.py | 12 | 
5 files changed, 53 insertions, 0 deletions
diff --git a/snippets/python/cutf8.py b/snippets/python/cutf8.py new file mode 100644 index 0000000..fa3f8e5 --- /dev/null +++ b/snippets/python/cutf8.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +""".""" diff --git a/snippets/python/fabfile.py b/snippets/python/fabfile.py new file mode 100644 index 0000000..c519167 --- /dev/null +++ b/snippets/python/fabfile.py @@ -0,0 +1,33 @@ +"""Fabfile for automating some mundane tasks.""" +from fabric.api import cd, env, prefix, run + +# Use local SSH config +env.use_ssh_config = True + + +def prod(): +    """Production host.""" +    env.hosts = ['myserver'] +    env.virtual_env = 'projname' +    env.forward_agent = True + + +def prod_old(): +    """Old way of defining.""" +    env.user = 'cody' +    env.hosts = ['123.123.123.123:1234'] +    env.virtual_env = 'projname' +    env.forward_agent = True + + +def deploy_virstualenv(): +    """Deploy through virtualenv.""" +    with prefix('workon {}'.format(env.virtual_env)): +        run('deploy') + + +def deploy_git_folder(): +    """Deploy the application.""" +    with cd('www'): +        run('git fetch origin master') +        run('git reset --hard origin/master') diff --git a/snippets/python/pudb.py b/snippets/python/pudb.py new file mode 100644 index 0000000..80b65ef --- /dev/null +++ b/snippets/python/pudb.py @@ -0,0 +1 @@ +from pudb import set_trace; set_trace() diff --git a/snippets/python/pyclass.py b/snippets/python/pyclass.py new file mode 100644 index 0000000..07d0493 --- /dev/null +++ b/snippets/python/pyclass.py @@ -0,0 +1,5 @@ + class jump(jump): +     """jump + +     jump +     """ diff --git a/snippets/python/pydef.py b/snippets/python/pydef.py new file mode 100644 index 0000000..a3d8224 --- /dev/null +++ b/snippets/python/pydef.py @@ -0,0 +1,12 @@ +def jump(jump): +    """jump. + +    jump + +    Args: +        jump (jump_type): jump_desc +            Example: jump + +    Return: +        jump_type: jump_desc +    """  | 
