python automated headers自動生成フォーマットコメントファイルdocstrings


方法1:gvim
http://stackoverflow.com/questions/6201302/how-to-have-automated-headers-for-python-files https://sites.google.com/site/bcgeopython/examples/eclipse-pydev/pydev—creating-automated-headers-in-eclipse
template: /******************************************************************* * @file * * @date * @author John Doe * @email [email protected] * * @brief * * @detail * *******************************************************************/、
で、vimrcで構成する"Reads the template file replacing the tags by the actual"information and insert the result at the beginning of the buffer.At ” the end, creates two blank lines at the end of the file and ” position the cursor at the first one. function! s:insert_description() let template = $HOME . “/.vim/template/cpp.template” let file_name = expand(“%:t”) ” Get file name without path let date = strftime(“%Y”) ” Get the current year in format YYYY let i = 0 for line in readfile(template) let line = substitute(line, “”, file_name, “ge”) let line = substitute(line, “”, date, “ge”) call append(i, line) let i += 1 endfor execute “normal! Go\k” endfunction autocmd BufNewFile *.{c++,cpp,cc,c,h,hpp} call insert_description()
方法2:Eclipse pydev
Eclipseのpydevを使用すると生成しやすくなりますhttps://sites.google.com/site/bcgeopython/examples/eclipse-pydev/pydev—creating-automated-headers-in-eclipse
Search this site Pages/Detailed How to’s‎ > ‎Eclipse/PyDev‎ > ‎ Eclipse/Pydev feature: Automated Headers in Eclipse Introduction
When creating python scripts it is always a good idea to include a header with various bits and pieces of information about a script. Often when it comes time to writing a script deadlines and stress prevent the creation of adequate/standardized header information. This article will show you how you can use eclipse to create a header template for you with minimal effort.
Configuring Eclipse to Add Headers
Go to The pulldown menu and select Window->Preferences. The following form should appear.
On the left hand side of the form you should see a bunch of options with + boxes next to them. Find PyDev, then click on Code Completion->Templates. You should now see a dialog similar to the one show below.
Now choose New… You will be presented with a dialog similar to the one show below. Fill in each of the boxes with the following information:
Name: header
Description: Automatically creates a header template for you.
Pattern: (cut and paste the following into pattern)
”’
Author:        
Purpose:       
Date:          
Arguments:     
Outputs:      
Dependencies: 

History:      
--------------------------------------------------------------
Date: 
Author: 
Modification: 
--------------------------------------------------------------

”’
Using The Header Template
You should now be able to easily use your header tempate. Now whenever you create a new file, simply type the word “header” and then press ctrl and spacebar at the same time and your header template should appear. Now all you need to do is fill it out.
Once the initial code is created and you now want to either add new features, or modify the code somehow, fill in unique a history event.
Docstrings
http://www.pydev.org/manual_adv_editor_prefs.html
With Ctrl+1 when over a function line, you can create the docstring automatically (and these preferences are used to determine what’s the result of doing so)