Add Python snippets for YASnippets

This commit is contained in:
Gerard Vermeulen 2022-12-27 10:45:55 +01:00
parent eb6cda3025
commit 85d644c68a
6 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : base class
# key : bcls
# expand-env: ((yas-indent-line 'fixed))
# --
class ${1:ClassName}:
"""${2:XXX}.${3:$(python-arguments-to-doc-string)}"""
def __init__(self, $3):
${3:$(python-arguments-to-self-init-string)}$0pass

View File

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : def function
# key : deff
# --
def ${1:name}($2):
"""${3:XXX.}${2:$(python-arguments-to-doc-string)}"""
$0pass

View File

@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : def method
# key : defm
# --
def ${1:name}(self$2):
"""${3:XXX.}${2:$(python-arguments-to-doc-string)}"""
$0pass

View File

@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Uses .yas-setup.el.
# name : derived class
# key : dcls
# expand-env: ((yas-indent-line 'fixed))
# --
class ${1:ClassName}(${2:object}):
"""${3:XXX}.${4:$(python-arguments-to-doc-string)}"""
def __init__(self, $4):
${4:$(python-arguments-to-self-init-string)}$0pass

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# name : program
# key : program
# expand-env : ((yas-indent-line 'fixed))
# --
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""${1:XXX}."""
import numpy
def main():
"""${2:XXX}."""
$0pass
if __name__ == '__main__':
main()
# Local Variables:
# mode: python
# End:

View File

@ -0,0 +1,2 @@
python-mode