Use "# TODO: write code..." as code placeholder in Python snippets (#34)

This commit is contained in:
Jakub Stasiak 2012-11-03 12:03:52 +01:00
parent d734f6eb02
commit 9a63deb18a

View File

@ -13,16 +13,16 @@ snippet docs
''' '''
snippet wh snippet wh
while ${1:condition}: while ${1:condition}:
${2:# code...} ${2:# TODO: write code...}
# dowh - does the same as do...while in other languages # dowh - does the same as do...while in other languages
snippet dowh snippet dowh
while True: while True:
${1:# code...} ${1:# TODO: write code...}
if ${2:condition}: if ${2:condition}:
break break
snippet with snippet with
with ${1:expr} as ${2:var}: with ${1:expr} as ${2:var}:
${3:# code...} ${3:# TODO: write code...}
# New Class # New Class
snippet cl snippet cl
class ${1:ClassName}(${2:object}): class ${1:ClassName}(${2:object}):
@ -35,14 +35,14 @@ snippet cl
snippet def snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}""" """${3:docstring for $1}"""
${4:pass} ${4:# TODO: write code...}
snippet deff snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${3} ${3:# TODO: write code...}
# New Method # New Method
snippet defs snippet defs
def ${1:mname}(self, ${2:arg}): def ${1:mname}(self, ${2:arg}):
${3:pass} ${3:# TODO: write code...}
# New Property # New Property
snippet property snippet property
def ${1:foo}(): def ${1:foo}():
@ -54,17 +54,17 @@ snippet property
# Ifs # Ifs
snippet if snippet if
if ${1:condition}: if ${1:condition}:
${2:code...} ${2:# TODO: write code...}
snippet el snippet el
else: else:
${1:code...} ${1:# TODO: write code...}
snippet ei snippet ei
elif ${1:condition}: elif ${1:condition}:
${2:code...} ${2:# TODO: write code...}
# For # For
snippet for snippet for
for ${1:item} in ${2:items}: for ${1:item} in ${2:items}:
${3:code...} ${3:# TODO: write code...}
# Encodes # Encodes
snippet cutf8 snippet cutf8
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
@ -79,32 +79,32 @@ snippet .
self. self.
snippet try Try/Except snippet try Try/Except
try: try:
${1:pass} ${1:# TODO: write code...}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
snippet try Try/Except/Else snippet try Try/Except/Else
try: try:
${1:pass} ${1:# TODO: write code...}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
else: else:
${5:pass} ${5:# TODO: write code...}
snippet try Try/Except/Finally snippet try Try/Except/Finally
try: try:
${1:pass} ${1:# TODO: write code...}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
finally: finally:
${5:pass} ${5:# TODO: write code...}
snippet try Try/Except/Else/Finally snippet try Try/Except/Else/Finally
try: try:
${1:pass} ${1:# TODO: write code...}
except ${2:Exception}, ${3:e}: except ${2:Exception}, ${3:e}:
${4:raise $3} ${4:raise $3}
else: else:
${5:pass} ${5:# TODO: write code...}
finally: finally:
${6:pass} ${6:# TODO: write code...}
# if __name__ == '__main__': # if __name__ == '__main__':
snippet ifmain snippet ifmain
if __name__ == '__main__': if __name__ == '__main__':
@ -130,12 +130,12 @@ snippet "
# test function/method # test function/method
snippet test snippet test
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}): def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
${3:pass} ${3:# TODO: write code...}
# test case # test case
snippet testcase snippet testcase
class ${1:ExampleCase}(unittest.TestCase): class ${1:ExampleCase}(unittest.TestCase):
def test_${2:description}(self): def test_${2:description}(self):
${3:pass} ${3:# TODO: write code...}
snippet fut snippet fut
from __future__ import ${1} from __future__ import ${1}