mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
py: flake8 fixes
This commit is contained in:
parent
97ce776e7b
commit
d7b04ae7a7
@ -22,8 +22,6 @@ def main(argv):
|
|||||||
args = argparser.parse_args(argv)
|
args = argparser.parse_args(argv)
|
||||||
|
|
||||||
with args.file:
|
with args.file:
|
||||||
include_dirs = []
|
|
||||||
|
|
||||||
iwyu = Popen(['include-what-you-use', '-xc'] + args.iwyu_args + ['/dev/stdin'],
|
iwyu = Popen(['include-what-you-use', '-xc'] + args.iwyu_args + ['/dev/stdin'],
|
||||||
stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ SITENAVI_SEARCH = '<table width="100%"><tbody><tr><td>' + SITENAVI_LINKS_WEB + \
|
|||||||
|
|
||||||
TEXTSTART = """
|
TEXTSTART = """
|
||||||
<div id="d1">
|
<div id="d1">
|
||||||
<pre id="sp"> </pre>
|
<pre id="sp">""" + (" " * 80) + """</pre>
|
||||||
<div id="d2">
|
<div id="d2">
|
||||||
<pre>
|
<pre>
|
||||||
"""
|
"""
|
||||||
|
@ -36,7 +36,6 @@ import shutil
|
|||||||
import textwrap
|
import textwrap
|
||||||
import subprocess
|
import subprocess
|
||||||
import collections
|
import collections
|
||||||
import pprint
|
|
||||||
|
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
@ -295,10 +294,9 @@ def render_params(parent, width=62):
|
|||||||
out += '{}{}\n'.format(name, desc)
|
out += '{}{}\n'.format(name, desc)
|
||||||
return out.rstrip()
|
return out.rstrip()
|
||||||
|
|
||||||
# Renders a node as Vim help text, recursively traversing all descendants.
|
|
||||||
|
|
||||||
|
|
||||||
def render_node(n, text, prefix='', indent='', width=62):
|
def render_node(n, text, prefix='', indent='', width=62):
|
||||||
|
"""Renders a node as Vim help text, recursively traversing all descendants."""
|
||||||
text = ''
|
text = ''
|
||||||
# space_preceding = (len(text) > 0 and ' ' == text[-1][-1])
|
# space_preceding = (len(text) > 0 and ' ' == text[-1][-1])
|
||||||
# text += (int(not space_preceding) * ' ')
|
# text += (int(not space_preceding) * ' ')
|
||||||
@ -322,9 +320,11 @@ def render_node(n, text, prefix='', indent='', width=62):
|
|||||||
text += ' [verbatim] {}'.format(get_text(n))
|
text += ' [verbatim] {}'.format(get_text(n))
|
||||||
elif n.nodeName == 'listitem':
|
elif n.nodeName == 'listitem':
|
||||||
for c in n.childNodes:
|
for c in n.childNodes:
|
||||||
text += indent + prefix + \
|
text += (
|
||||||
render_node(c, text, indent=indent +
|
indent
|
||||||
(' ' * len(prefix)), width=width)
|
+ prefix
|
||||||
|
+ render_node(c, text, indent=indent + (' ' * len(prefix)), width=width)
|
||||||
|
)
|
||||||
elif n.nodeName in ('para', 'heading'):
|
elif n.nodeName in ('para', 'heading'):
|
||||||
for c in n.childNodes:
|
for c in n.childNodes:
|
||||||
text += render_node(c, text, indent=indent, width=width)
|
text += render_node(c, text, indent=indent, width=width)
|
||||||
@ -693,7 +693,8 @@ def gen_docs(config):
|
|||||||
for filename in CONFIG[mode]['section_order']:
|
for filename in CONFIG[mode]['section_order']:
|
||||||
if filename not in sections:
|
if filename not in sections:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'found new module "{}"; update the "section_order" map'.format(filename))
|
'found new module "{}"; update the "section_order" map'.format(
|
||||||
|
filename))
|
||||||
title, helptag, section_doc = sections.pop(filename)
|
title, helptag, section_doc = sections.pop(filename)
|
||||||
i += 1
|
i += 1
|
||||||
if filename not in CONFIG[mode]['append_only']:
|
if filename not in CONFIG[mode]['append_only']:
|
||||||
|
13
src/clint.py
13
src/clint.py
@ -2610,9 +2610,13 @@ def CheckBraces(filename, clean_lines, linenum, error):
|
|||||||
'Brace starting function body must be placed on its own line')
|
'Brace starting function body must be placed on its own line')
|
||||||
else:
|
else:
|
||||||
func_start_linenum = end_linenum + 1
|
func_start_linenum = end_linenum + 1
|
||||||
while not clean_lines.lines[func_start_linenum] == '{':
|
while not clean_lines.lines[func_start_linenum] == "{":
|
||||||
attrline = Match(r'^((?!# *define).*?)(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+(?:\(\d+(, \d+)*\))?',
|
attrline = Match(
|
||||||
clean_lines.lines[func_start_linenum])
|
r'^((?!# *define).*?)'
|
||||||
|
r'(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+'
|
||||||
|
r'(?:\(\d+(, \d+)*\))?',
|
||||||
|
clean_lines.lines[func_start_linenum],
|
||||||
|
)
|
||||||
if attrline:
|
if attrline:
|
||||||
if len(attrline.group(1)) != 2:
|
if len(attrline.group(1)) != 2:
|
||||||
error(filename, func_start_linenum,
|
error(filename, func_start_linenum,
|
||||||
@ -3182,7 +3186,8 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
|
|||||||
r'|li_(?:next|prev|tv))\b', line)
|
r'|li_(?:next|prev|tv))\b', line)
|
||||||
if match:
|
if match:
|
||||||
error(filename, linenum, 'runtime/deprecated', 4,
|
error(filename, linenum, 'runtime/deprecated', 4,
|
||||||
'Accessing list_T internals directly is prohibited (hint: see commit d46e37cb4c71)')
|
'Accessing list_T internals directly is prohibited '
|
||||||
|
'(hint: see commit d46e37cb4c71)')
|
||||||
|
|
||||||
# Check for suspicious usage of "if" like
|
# Check for suspicious usage of "if" like
|
||||||
# } if (a == b) {
|
# } if (a == b) {
|
||||||
|
@ -8,6 +8,7 @@ import locale
|
|||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def set_output_encoding(enc=None):
|
def set_output_encoding(enc=None):
|
||||||
"""Set the encoding of stdout and stderr
|
"""Set the encoding of stdout and stderr
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ def set_output_encoding(enc=None):
|
|||||||
writer = io.open(fo.fileno(), mode='w', newline='', **kw)
|
writer = io.open(fo.fileno(), mode='w', newline='', **kw)
|
||||||
write = writer.write # save the original write() function
|
write = writer.write # save the original write() function
|
||||||
enc = locale.getpreferredencoding()
|
enc = locale.getpreferredencoding()
|
||||||
|
|
||||||
def convwrite(s):
|
def convwrite(s):
|
||||||
if isinstance(s, bytes):
|
if isinstance(s, bytes):
|
||||||
write(s.decode(enc)) # convert to unistr
|
write(s.decode(enc)) # convert to unistr
|
||||||
|
Loading…
Reference in New Issue
Block a user