Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4d7bfe2

Browse files
committed
Merge branch 'release/0.6.16'
2 parents32d586b +f917991 commit4d7bfe2

File tree

17 files changed

+593
-226
lines changed

17 files changed

+593
-226
lines changed

‎Changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
=========
33

4+
## 2013-04-26 0.6.16
5+
--------------------
6+
* Improvement folding (thanks @alvinfrancis);
7+
8+
## 2013-04-01 0.6.15
9+
--------------------
10+
* Bugfix release
11+
412
## 2013-03-16 0.6.14
513
--------------------
614
* Update `PEP8` to version 1.4.5;

‎README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Then rebuild **helptags** in vim::
9696
Troubleshooting
9797
===============
9898

99-
If your python-mode dont work, type command: ::
99+
If your python-mode dont work,open any python file andtype command: ::
100100

101101
:call pymode#troubleshooting#Test()
102102

‎autoload/pymode.vim

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,24 @@ fun! pymode#QuickfixOpen(onlyRecognized, holdCursor, maxHeight, minHeight, jumpE
5050
endfunction"}}}
5151

5252

53-
fun!pymode#PlaceSigns()"{{{
53+
fun!pymode#PlaceSigns(bnum)"{{{
5454
" DESC: Place error signs
5555
"
5656
ifhas('signs')
57-
sign unplace*
57+
callpymode#Default('b:pymode_signs', [])
58+
59+
for iteminb:pymode_signs
60+
executeprintf('sign unplace %d buffer=%d', item.lnum, item.bufnr)
61+
endfor
62+
letb:pymode_signs= []
5863

5964
if!pymode#Default("g:pymode_lint_signs_always_visible",0)||g:pymode_lint_signs_always_visible
6065
callRopeShowSignsRulerIfNeeded()
6166
endif
6267

6368
for iteminfilter(getqflist(),'v:val.bufnr != ""')
64-
executeprintf('silent! sign place 1 line=%d name=%s buffer=%d', item.lnum, item.type, item.bufnr)
69+
calladd(b:pymode_signs, item)
70+
executeprintf('sign place %d line=%d name=%s buffer=%d', item.lnum, item.lnum,"Pymode".item.type, item.bufnr)
6571
endfor
6672

6773
endif

‎autoload/pymode/folding.vim

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33

44
lets:blank_regex='^\s*$'
5-
lets:def_regex='^\s*\(class\|def\) \w\+'
5+
lets:def_regex='^\s*\%(class\|def\) \w\+'
6+
lets:decorator_regex='^\s*@'
7+
lets:doc_begin_regex='^\s*\%("""\|''''''\)'
8+
lets:doc_end_regex='\%("""\|''''''\)\s*$'
9+
lets:doc_line_regex='^\s*\("""\|''''''\).\+\1\s*$'
610

711

812
fun!pymode#folding#text()" {{{
913
letfs=v:foldstart
10-
whilegetline(fs)=~'^\s*@'
14+
whilegetline(fs)=~'\%(^\s*@\)\|\%(^\s*\%("""\|''''''\)\s*$\)'
1115
letfs=nextnonblank(fs+1)
1216
endwhile
1317
letline=getline(fs)
@@ -21,6 +25,7 @@ fun! pymode#folding#text() " {{{
2125
letline=substitute(line,'\t', onetab,'g')
2226

2327
letline=strpart(line,0, windowwidth-2-len(foldedlinecount))
28+
letline=substitute(line,'\%("""\|''''''\)','','')
2429
let fillcharcount= windowwidth-len(line)-len(foldedlinecount)
2530
returnline .'' .repeat("",fillcharcount) . foldedlinecount .'' .''
2631
endfunction"}}}
@@ -30,21 +35,32 @@ fun! pymode#folding#expr(lnum) "{{{
3035

3136
letline=getline(a:lnum)
3237
letindent=indent(a:lnum)
38+
let prev_line=getline(a:lnum-1)
39+
40+
ifline=~s:def_regex||line=~s:decorator_regex
41+
if prev_line=~s:decorator_regex
42+
return'='
43+
else
44+
return">".(indent / &shiftwidth+1)
45+
endif
46+
endif
3347

34-
ifline=~s:def_regex
35-
return">".(indent / &shiftwidth+1)
48+
ifline=~s:doc_begin_regex
49+
\&&line!~s:doc_line_regex
50+
\&& prev_line=~s:def_regex
51+
return">".(indent / &shiftwidth+1)
3652
endif
3753

38-
ifline=~'^\s*@'
39-
return-1
54+
ifline=~s:doc_end_regex
55+
\&&line!~s:doc_line_regex
56+
return"<".(indent / &shiftwidth+1)
4057
endif
4158

4259
ifline=~s:blank_regex
43-
let prev_line=getline(a:lnum-1)
4460
if prev_line=~s:blank_regex
4561
return-1
4662
else
47-
returnfoldlevel(prevnonblank(a:lnum))
63+
return'='
4864
endif
4965
endif
5066

‎autoload/pymode/lint.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ fun! pymode#lint#Check() "{{{
2020
endfunction" }}}
2121

2222

23-
fun!pymode#lint#Parse()
23+
fun!pymode#lint#Parse(bnum)
2424
" DESC: Parse result of code checking.
2525
"
2626
callsetqflist(g:qf_list,'r')
2727

2828
ifg:pymode_lint_signs
29-
callpymode#PlaceSigns()
29+
callpymode#PlaceSigns(a:bnum)
3030
endif
3131

3232
ifg:pymode_lint_cwindow

‎doc/pymode.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(__) (__) (__) (_) (_)(_____)(_)\_) (_/\/\_)(_____)(____/(____)~
77

88

9-
Version: 0.6.14
9+
Version: 0.6.16
1010

1111
==============================================================================
1212
CONTENTS*Python-mode-contents*
@@ -29,7 +29,7 @@ Python-mode is a vim plugin that allows you to use the pylint, rope, and pydoc
2929
libraries in vim to provide features like python code bug checking,
3030
refactoring, and some other useful things.
3131

32-
This pluginallow you create python code in vim very easily. There is no need
32+
This pluginallows you to create python code in vim very easily. There is no need
3333
to install the pylint or rope libraries on your system.
3434

3535

@@ -122,9 +122,9 @@ To enable any of the options below you should put the given line in your
122122
2.2. Modeline~
123123
*PythonModeModeline*
124124

125-
Feature likeVIM modeline `:help modeline`. Allow changing pymode options for
126-
editedfile. Pymode modeline should always be the last line in the file and
127-
look like:
125+
TheVIM modeline `:help modeline` feature allows you to change pymode
126+
options for the currentfile. Pymode modeline should always be the
127+
last line in the vimrc file andlook like:
128128

129129
>
130130
# pymode:lint_ignore=E0202:doc=0:lint_write=0
@@ -142,7 +142,7 @@ Set linters and mccabe complexity.
142142
# pymode:lint_checker=pip,mccabe:lint_mccabe_complexity=10
143143
<
144144

145-
This changes will work only in current buffer.
145+
These changes will work only in the current buffer.
146146

147147
------------------------------------------------------------------------------
148148
*'pymode'*
@@ -156,7 +156,7 @@ If this option is set to 0 then the whole plugin is disabled
156156
Values: List of strings
157157
Default: [].
158158

159-
This optionset additional python import paths
159+
This optionsets additional python import paths
160160

161161
------------------------------------------------------------------------------
162162
*'pymode_doc'*
@@ -169,20 +169,20 @@ If this option is set to 0 then the doc script is disabled.
169169
*'pymode_doc_key'*
170170
Default: 'K'.
171171

172-
Set keyfor show python documentation.
172+
Setthekeyto show the show python documentation.
173173

174174
------------------------------------------------------------------------------
175175
*'pymode_run'*
176176
Values: 0 or 1.
177177
Default: 1.
178178

179-
If this option is set to 0 then run script is disabled.
179+
If this option is set to 0 thentherun script is disabled.
180180

181181
------------------------------------------------------------------------------
182182
*'pymode_run_key'*
183183
Default: '<leader>r'.
184184

185-
Set key forrun python code.
185+
Setthekey forrunning python code.
186186

187187
------------------------------------------------------------------------------
188188
*'pymode_lint'*
@@ -279,7 +279,7 @@ Values: 0 or 1.
279279
Default: 0.
280280

281281
If this option is set to 0 then pylint will switch on the quickfix window when
282-
it opens. Doesn't work when|'pymode_lint_jump'| enabled.
282+
it opens. Doesn't work when|'pymode_lint_jump'|isenabled.
283283

284284
------------------------------------------------------------------------------
285285
*'pymode_lint_minheight'*
@@ -349,7 +349,7 @@ not be used.
349349
Values: 0 or 1.
350350
Default: 1.
351351

352-
If this option is set to 1, pymode will enable python indentation support
352+
If this option is set to 1, pymode will enable python indentation support.
353353

354354
------------------------------------------------------------------------------
355355
*'pymode_folding'*
@@ -452,8 +452,8 @@ iM Operation with inner function or method.
452452
Python-mode doesn't work
453453
------------------------
454454

455-
Run":call pymode#troubleshooting#Test()" and fix the warning or send me the
456-
output.
455+
Open any python file and run":call pymode#troubleshooting#Test()",
456+
fix the warning or send me theoutput.
457457

458458

459459
Rope completion is very slow
@@ -463,8 +463,8 @@ To work, rope_ creates a service directory: `.ropeproject`. If
463463
|'pymode_rope_guess_project'| is set on (as it is by default) and
464464
`.ropeproject` is not found in the current dir, rope will scan for
465465
`.ropeproject` in every dir in the parent path. If rope finds`.ropeproject`
466-
in parent dirs, rope setsproject for all childdir and the scan may beslow
467-
for many dirs and files.
466+
in parent dirs, rope setsprojectis for all childdirs and the scan may be
467+
slowfor many dirs and files.
468468

469469
Solutions:
470470

@@ -479,7 +479,7 @@ Solutions:
479479
Pylint check is very slow
480480
-------------------------
481481

482-
In some projects pylint_ may check slowly, because it alsoscan imported
482+
In some projects pylint_ may check slowly, because it alsoscans imported
483483
modules if possible. Try using pyflakes: see|'pymode_lint_checker'|.
484484

485485
You may set|exrc| and|secure| in your|vimrc| to auto-set custom settings

‎ftplugin/python/init-pymode.vim

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if exists('did_init_pymode_vim')
33
endif
44
let did_init_pymode_vim=1
55

6-
letg:pymode_version="0.6.14"
6+
letg:pymode_version="0.6.16"
77

88
com! PymodeVersionechomsg"Current python-mode version:" .g:pymode_version
99

@@ -111,11 +111,12 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
111111
if (!pymode#Default("g:pymode_lint_signs",1)||g:pymode_lint_signs)&&has('signs')
112112

113113
" DESC: Signs definition
114-
signdefine W text=WW texthl=Todo
115-
signdefine C text=CC texthl=Comment
116-
signdefine R text=RR texthl=Visual
117-
signdefine E text=EE texthl=Error
118-
signdefine I text=II texthl=Info
114+
signdefine PymodeW text=WW texthl=Todo
115+
signdefine PymodeC text=CC texthl=Comment
116+
signdefine PymodeR text=RR texthl=Visual
117+
signdefine PymodeE text=EE texthl=Error
118+
signdefine PymodeI text=II texthl=Info
119+
signdefine PymodeF text=FF texthl=Info
119120

120121
if!pymode#Default("g:pymode_lint_signs_always_visible",0)||g:pymode_lint_signs_always_visible
121122
" Show the sign's ruller if asked for, even it there's no error to show
@@ -127,7 +128,7 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
127128

128129
" DESC: Set default pylint configuration
129130
if!filereadable(g:pymode_lint_config)
130-
letg:pymode_lint_config=expand("<sfile>:p:h:h") ."/pylint.ini"
131+
letg:pymode_lint_config=expand("<sfile>:p:h:h:h") ."/pylint.ini"
131132
endif
132133

133134
py from pymodeimport queue

‎pylibs/pylama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" pylama -- Python code audit. "
22

3-
version_info= (0,2,3)
3+
version_info= (0,3,0)
44

55
__version__=version='.'.join(map(str,version_info))
66
__project__=__name__

‎pylibs/pylama/hook.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
importsys
2+
fromosimportpathasop,chmod
3+
fromsubprocessimportPopen,PIPE
4+
from .mainimportlogger
5+
6+
7+
try:
8+
fromconfigparserimportConfigParser# nolint
9+
exceptImportError:# Python 2
10+
fromConfigParserimportConfigParser
11+
12+
13+
defrun(command):
14+
p=Popen(command.split(),stdout=PIPE,stderr=PIPE)
15+
(stdout,stderr)=p.communicate()
16+
return (p.returncode, [line.strip()forlineinstdout.splitlines()],
17+
[line.strip()forlineinstderr.splitlines()])
18+
19+
20+
defgit_hook():
21+
from .mainimportcheck_files
22+
_,files_modified,_=run("git diff-index --cached --name-only HEAD")
23+
logger.setLevel('WARN')
24+
check_files([fforfinmap(str,files_modified)iff.endswith('.py')])
25+
26+
27+
defhg_hook(ui,repo,**kwargs):
28+
from .mainimportcheck_files
29+
seen=set()
30+
paths= []
31+
forrevinrange(repo[kwargs['node']],len(repo)):
32+
forfile_inrepo[rev].files():
33+
file_=op.join(repo.root,file_)
34+
iffile_inseenornotop.exists(file_):
35+
continue
36+
seen.add(file_)
37+
iffile_.endswith('.py'):
38+
paths.append(file_)
39+
logger.setLevel('WARN')
40+
check_files(paths)
41+
42+
43+
definstall_git(path):
44+
hook=op.join(path,'pre-commit')
45+
withopen(hook,'w+')asfd:
46+
fd.write("""#!/usr/bin/env python
47+
import sys
48+
from pylama.hook import git_hook
49+
50+
if __name__ == '__main__':
51+
sys.exit(git_hook())
52+
""")
53+
chmod(hook,484)
54+
returnTrue
55+
56+
57+
definstall_hg(path):
58+
hook=op.join(path,'hgrc')
59+
ifnotop.isfile(hook):
60+
open(hook,'w+').close()
61+
62+
c=ConfigParser()
63+
c.readfp(open(path,'r'))
64+
ifnotc.has_section('hooks'):
65+
c.add_section('hooks')
66+
67+
ifnotc.has_option('hooks','commit'):
68+
c.set('hooks','commit','python:pylama.hooks.hg_hook')
69+
70+
ifnotc.has_option('hooks','qrefresh'):
71+
c.set('hooks','qrefresh','python:pylama.hooks.hg_hook')
72+
73+
c.write(open(path,'w+'))
74+
returnTrue
75+
76+
77+
definstall_hook(path):
78+
git=op.join(path,'.git','hooks')
79+
hg=op.join(path,'.hg')
80+
ifop.exists(git):
81+
install_git(git)andlogger.warn('Git hook has been installed.')# nolint
82+
83+
elifop.exists(hg):
84+
install_hg(git)andlogger.warn('Mercurial hook has been installed.')# nolint
85+
86+
else:
87+
logger.error('VCS has not found. Check your path.')
88+
sys.exit(1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp