Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit c4ea502

Browse files
committed
Make newline optional in docstrings.
Also use longstrings for readability, and updated class snippet to make superclass section optional. Thanks to Pedro A. Aranda Gutiérrez.
1 parent 4a7b157 commit c4ea502

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

init.lua

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,23 @@ end
134134
local snip = snippets.python
135135
snip['.'] = 'self.'
136136
snip.__ = '__%1(init)__'
137-
snip.def = "def %1(name)(%2(arg)):\n\t%3('''%4\n\t'''\n\t)"
138-
snip.defs = "def %1(name)(self%2(, %3(arg))):\n\t%4('''%5\n\t'''\n\t)"
139-
snip.ifmain = "if __name__ == '__main__':\n\t%1(main())"
137+
snip.def = [[
138+
def %1(name)(%2(arg)):
139+
%3('''%4'''
140+
)]]
141+
snip.defs = [[
142+
def %1(name)(self%2(, %3(arg))):
143+
%4('''%5'''
144+
)]]
145+
snip.ifmain = [[
146+
if __name__ == '__main__':
147+
%1(main())]]
140148
snip.class = [[
141-
class %1(ClassName)(%2(object)):
142-
'''%3(documentation)
143-
'''
144-
def __init__(self%4(, %5(arg))):
145-
%6(super(%1, self).__init__())]]
149+
class %1(ClassName)%2((%3(object))):
150+
%4('''%5(documentation)'''
151+
152+
)def __init__(self%6(, %7(arg))):
153+
%8(super(%1, self).__init__())]]
146154
snip.try = [[
147155
try:
148156
%0

0 commit comments

Comments
 (0)