Skip to content

Commit d320933

Browse files
committed
Lint fixes (vint)
1 parent e0562c8 commit d320933

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

indent/python.vim

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
" <http://creativecommons.org/publicdomain/zero/1.0/>.
2121

2222
" Only load this indent file when no other was loaded.
23-
if exists("b:did_indent")
23+
if exists('b:did_indent')
2424
finish
2525
endif
2626
let b:did_indent = 1
@@ -44,7 +44,7 @@ let s:block_rules_multiple = {
4444
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
4545
\ }
4646
let s:paren_pairs = ['()', '{}', '[]']
47-
if &ft == 'pyrex' || &ft == 'cython'
47+
if &filetype ==# 'pyrex' || &filetype ==# 'cython'
4848
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
4949
else
5050
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
@@ -82,7 +82,7 @@ if exists('*shiftwidth')
8282
endfunction
8383
else
8484
function! s:sw()
85-
return &sw
85+
return &shiftwidth
8686
endfunction
8787
endif
8888

@@ -127,7 +127,7 @@ endfunction
127127
function! s:find_start_of_multiline_statement(lnum)
128128
let lnum = a:lnum
129129
while lnum > 0
130-
if getline(lnum - 1) =~ '\\$'
130+
if getline(lnum - 1) =~# '\\$'
131131
let lnum = prevnonblank(lnum - 1)
132132
else
133133
let [paren_lnum, _] = s:find_opening_paren(lnum)
@@ -182,7 +182,7 @@ function! s:match_expr_on_line(expr, lnum, start, ...)
182182
let r = 1
183183
for i in range(a:start, end)
184184
call cursor(a:lnum, i)
185-
if !(eval(a:expr) || text[i-1] =~ '\s')
185+
if !(eval(a:expr) || text[i-1] =~# '\s')
186186
let r = 0
187187
break
188188
endif
@@ -202,7 +202,7 @@ function! s:indent_like_opening_paren(lnum)
202202

203203
let nothing_after_opening_paren = s:match_expr_on_line(
204204
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
205-
let starts_with_closing_paren = getline(a:lnum) =~ '^\s*[])}]'
205+
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
206206

207207
if nothing_after_opening_paren
208208
if starts_with_closing_paren
@@ -276,18 +276,18 @@ function! s:indent_like_previous_line(lnum)
276276

277277
" Search for final colon that is not inside something to be ignored.
278278
while 1
279-
let curpos = getpos(".")[2]
279+
let curpos = getpos('.')[2]
280280
if curpos == 1 | break | endif
281-
if eval(s:skip_special_chars) || text[curpos-1] =~ '\s'
281+
if eval(s:skip_special_chars) || text[curpos-1] =~# '\s'
282282
normal! h
283283
continue
284-
elseif text[curpos-1] == ':'
284+
elseif text[curpos-1] ==# ':'
285285
return base + s:sw()
286286
endif
287287
break
288288
endwhile
289289

290-
if text =~ '\\$' && !ignore_last_char
290+
if text =~# '\\$' && !ignore_last_char
291291
" If this line is the continuation of a control statement
292292
" indent further to distinguish the continuation line
293293
" from the next logical line.
@@ -336,7 +336,7 @@ function! s:is_python_string(lnum, ...)
336336
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
337337
for cnum in cols
338338
if match(map(synstack(a:lnum, cnum),
339-
\ 'synIDattr(v:val,"name")'), 'python\S*String') == -1
339+
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
340340
return 0
341341
end
342342
endfor
@@ -361,7 +361,7 @@ function! GetPythonPEPIndent(lnum)
361361
let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
362362
if match_quotes != -1
363363
" closing multiline string
364-
let quotes = line[match_quotes:match_quotes+2]
364+
let quotes = line[match_quotes:(match_quotes+2)]
365365
let pairpos = searchpairpos(quotes, '', quotes, 'b')
366366
if pairpos[0] != 0
367367
return indent(pairpos[0])

0 commit comments

Comments
 (0)