From 66dea09d78278ecb8363bdd26df045f9d0f200d5 Mon Sep 17 00:00:00 2001 From: petitviolet Date: Tue, 4 Mar 2014 10:18:00 +0900 Subject: modified python template add __repr__ function to *-class.py add encoding declaration to base-*.py remove vim-encoding declaration from base-main.py --- template/python/base-class.py | 8 +++++--- template/python/base-main.py | 2 -- template/python/base-test.py | 1 + template/python/snip-class.py | 8 +++++--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/template/python/base-class.py b/template/python/base-class.py index 9ea3b27..0aa20ea 100644 --- a/template/python/base-class.py +++ b/template/python/base-class.py @@ -1,7 +1,9 @@ +# -*- encoding: utf-8 -*- """ {{_name_}} """ +class {{_expr_:substitute('{{_input_:name}}(object)', '\w\+', '\u\0', '')}}: + def __init__(self{{_cursor_}}): -class {{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}: - def __init__(self): - {{_cursor_}} + def __repr__(self): + return diff --git a/template/python/base-main.py b/template/python/base-main.py index e40b7ba..5f8bd8d 100644 --- a/template/python/base-main.py +++ b/template/python/base-main.py @@ -1,5 +1,3 @@ -# vim: fileencoding=utf-8 - def main(): {{_cursor_}} diff --git a/template/python/base-test.py b/template/python/base-test.py index 9f00533..089a0cb 100644 --- a/template/python/base-test.py +++ b/template/python/base-test.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- """ {{_name_}} """ diff --git a/template/python/snip-class.py b/template/python/snip-class.py index c8ff23c..636204d 100644 --- a/template/python/snip-class.py +++ b/template/python/snip-class.py @@ -1,3 +1,5 @@ -class {{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}: - def __init__(self): - {{_cursor_}} +class {{_expr_:substitute('{{_input_:name}}(object)', '\w\+', '\u\0', '')}}: + def __init__(self{{_cursor_}}): + + def __repr__(self): + return -- cgit v1.2.3-54-g00ecf From 9dff39398139c258106247ddd6ef6c913b0a9eee Mon Sep 17 00:00:00 2001 From: petitviolet Date: Wed, 5 Mar 2014 11:44:03 +0900 Subject: revise python template --- template/python/base-class.py | 4 ++-- template/python/base-main.py | 2 ++ template/python/base-test.py | 1 - template/python/snip-class.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/template/python/base-class.py b/template/python/base-class.py index 0aa20ea..ba7c7d8 100644 --- a/template/python/base-class.py +++ b/template/python/base-class.py @@ -1,8 +1,8 @@ -# -*- encoding: utf-8 -*- """ {{_name_}} """ -class {{_expr_:substitute('{{_input_:name}}(object)', '\w\+', '\u\0', '')}}: + +class {{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}(object): def __init__(self{{_cursor_}}): def __repr__(self): diff --git a/template/python/base-main.py b/template/python/base-main.py index 5f8bd8d..e40b7ba 100644 --- a/template/python/base-main.py +++ b/template/python/base-main.py @@ -1,3 +1,5 @@ +# vim: fileencoding=utf-8 + def main(): {{_cursor_}} diff --git a/template/python/base-test.py b/template/python/base-test.py index 089a0cb..9f00533 100644 --- a/template/python/base-test.py +++ b/template/python/base-test.py @@ -1,4 +1,3 @@ -# -*- encoding: utf-8 -*- """ {{_name_}} """ diff --git a/template/python/snip-class.py b/template/python/snip-class.py index 636204d..aee2e08 100644 --- a/template/python/snip-class.py +++ b/template/python/snip-class.py @@ -1,4 +1,4 @@ -class {{_expr_:substitute('{{_input_:name}}(object)', '\w\+', '\u\0', '')}}: +class {{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}(object): def __init__(self{{_cursor_}}): def __repr__(self): -- cgit v1.2.3-54-g00ecf