Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: b7bfbd5f7c
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (24 sloc) 0.78 kB
<?xml version='1.0' encoding='utf-8'?>
<snippets language="python">
<snippet>
<text><![CDATA[$<
import re
global white_spaces
white_spaces = ''
regex=re.compile(r'(?P<white_spaces\>\s*)(def )?(?P<method\>[_ \w]+\w)[ ]?(\((?P<params\>.*)\))?:?')
regex=regex.match($GEDIT_CURRENT_LINE)
if regex:
dictionary=regex.groupdict()
method=dictionary['method'].replace(' ','_')
white_spaces=dictionary['white_spaces']
params= dictionary['params'] and 'self, ' + dictionary['params'] or 'self'
result = white_spaces + 'def ' + method + '(' + params + '):'
else:
result = $GEDIT_CURRENT_LINE
return result
>
$<return white_spaces>]]></text>
<accelerator><![CDATA[<Control>u]]></accelerator>
<description>Smart def</description>
</snippet>
</snippets>
Jump to Line
Something went wrong with that request. Please try again.