Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
177 lines (137 sloc) 2.37 KB
########### header and bottom
snippet code "coding:utf-8"
# coding: utf-8
endsnippet
snippet main "if main"
if __name__ == '__main__':
${1}
endsnippet
########### import
snippet im "import"
import ${1}
endsnippet
snippet imp "import"
import ${1:module}
${2}
endsnippet
snippet fim "from . import ."
from ${1} import ${2}
endsnippet
snippet from "from . import ."
from ${1} import ${2}
endsnippet
########### single char
snippet t "True"
True${1}
endsnippet
snippet f "False"
False${1}
endsnippet
snippet n "None"
None${1}
endsnippet
snippet r "return"
return ${1}
endsnippet
snippet s "self."
self.${1}
endsnippet
snippet p "print"
print ${1}
endsnippet
snippet pr "print "
print "${1}"
endsnippet
snippet pri "print ''"
print '${1}'
endsnippet
snippet prt "print trace"
print "TRACK ================= ${1}", ${2}
endsnippet
snippet rep "repr"
repr(${1})
endsnippet
snippet repr "repr"
repr(${1})
endsnippet
snippet _ "__func__"
__${1:init}__${2}
endsnippet
snippet # "# xxxx"
# ${1}
endsnippet
snippet a "assert"
assert ${1}
endsnippet
snippet isi "isinstance"
isinstance(${1}, ${2})
endsnippet
############# 逻辑控制
snippet el "else"
else:
${0:# TODO}
endsnippet
snippet ei "elif"
elif ${1}:
${2}
endsnippet
snippet while "while"
while ${1:expression}:
${0:# TODO}
endsnippet
#############
snippet defs "defs"
def ${1:fname}(self, ${2:**kwargs}):
"""${3:docstring for $1}"""
${3:pass}
endsnippet
snippet pro "property"
def ${1}():
doc = "${2: The $1 property.}"
def fget(self):
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
def fdel(self):
${5:del self._$1}
return locals()
$1 = property(**$1())
endsnippet
snippet init "init"
def __init__(self, ${1:args}):
${2}
endsnippet
snippet doc "docstring"
"""
@Author: ${1:`wklken`}
@Email: ${2:`wklken@yeah.net`}
@Date: ${3}
@Desc: ${4}
"""
endsnippet
snippet rai "raise"
raise ${1}
endsnippet
snippet tr "traceback"
import traceback; traceback.print_exc()
endsnippet
#############
snippet fin "[i for i in l]"
[${1:item} for ${2:$1} in ${3}]
endsnippet
snippet finif "[i for i in l if i]"
[${1:item} for ${2:$1} in ${3} if ${4:$1}]
endsnippet
snippet td "TODO:"
TODO: ${1}
endsnippet
snippet dk "api doc"
:url: ${1}
:method: POST GET
:params:
None
:return:(json/jsonp)
code:
code:
code:
endsnippet