You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
snippet #py "Set the python environment." |
|
#!/usr/bin/env python |
|
# -*- encoding: utf-8 -*- |
|
|
|
"""${1:Module documentation}""" |
|
|
|
$0 |
|
endsnippet |
|
|
|
snippet utf8 "Set the encoding for UTF-8" |
|
# -*- encoding: utf-8 -*- |
|
|
|
$0 |
|
endsnippet |
|
|
|
snippet class "Starting a Python class" |
|
class ${1:ClassName}(${2:object}): |
|
|
|
"""${3:Class documentation}""" |
|
|
|
$0 |
|
endsnippet |
|
|
|
snippet lint "Start a lint-disable comment" |
|
# pylint:disable=${0:lint code} |
|
endsnippet |
|
|
|
snippet from "Import a module from another" |
|
from ${1:source} import ${2:module} |
|
endsnippet |
|
|
|
snippet def "Function" |
|
def ${1:function name}(${2:parameters}): |
|
"""${3:Function description}""" |
|
$0 |
|
endsnippet |
|
|
|
snippet init "Class init" |
|
def __init__(self, ${0:params}): |
|
return |
|
endsnippet |
|
|
|
snippet nocover "Remove the block from the coverage" |
|
# pragma: no cover |
|
endsnippet |
|
|
|
snippet ain "assertIn" |
|
self.assertIn(${1:needle}, ${2:haystack}) |
|
endsnippet |
|
|
|
snippet logger "Add a logger for the module" |
|
logger = logging.getLogger(__name__) # pylint:disable=invalid-name |
|
endsnippet |
|
|
|
snippet pdb "Add the PDB call" |
|
import pdb; pdb.set_trace() |
|
endsnippet
|
|
|