mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
py: flake8 fixes
This commit is contained in:
parent
97ce776e7b
commit
d7b04ae7a7
@ -32,7 +32,7 @@ def get_color_code(bg, color_num):
|
||||
|
||||
def highlight(attrs):
|
||||
fg, bg = [int(attrs['foreground']), int(attrs['background'])]
|
||||
rv = [SGR0] # start with sgr0
|
||||
rv = [SGR0] # start with sgr0
|
||||
if fg != -1:
|
||||
rv.append(get_color_code(False, fg))
|
||||
if bg != -1:
|
||||
|
@ -22,8 +22,6 @@ def main(argv):
|
||||
args = argparser.parse_args(argv)
|
||||
|
||||
with args.file:
|
||||
include_dirs = []
|
||||
|
||||
iwyu = Popen(['include-what-you-use', '-xc'] + args.iwyu_args + ['/dev/stdin'],
|
||||
stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
|
@ -86,7 +86,7 @@ SITENAVI_SEARCH = '<table width="100%"><tbody><tr><td>' + SITENAVI_LINKS_WEB + \
|
||||
|
||||
TEXTSTART = """
|
||||
<div id="d1">
|
||||
<pre id="sp"> </pre>
|
||||
<pre id="sp">""" + (" " * 80) + """</pre>
|
||||
<div id="d2">
|
||||
<pre>
|
||||
"""
|
||||
|
@ -36,7 +36,6 @@ import shutil
|
||||
import textwrap
|
||||
import subprocess
|
||||
import collections
|
||||
import pprint
|
||||
|
||||
from xml.dom import minidom
|
||||
|
||||
@ -295,10 +294,9 @@ def render_params(parent, width=62):
|
||||
out += '{}{}\n'.format(name, desc)
|
||||
return out.rstrip()
|
||||
|
||||
# Renders a node as Vim help text, recursively traversing all descendants.
|
||||
|
||||
|
||||
def render_node(n, text, prefix='', indent='', width=62):
|
||||
"""Renders a node as Vim help text, recursively traversing all descendants."""
|
||||
text = ''
|
||||
# space_preceding = (len(text) > 0 and ' ' == text[-1][-1])
|
||||
# text += (int(not space_preceding) * ' ')
|
||||
@ -322,9 +320,11 @@ def render_node(n, text, prefix='', indent='', width=62):
|
||||
text += ' [verbatim] {}'.format(get_text(n))
|
||||
elif n.nodeName == 'listitem':
|
||||
for c in n.childNodes:
|
||||
text += indent + prefix + \
|
||||
render_node(c, text, indent=indent +
|
||||
(' ' * len(prefix)), width=width)
|
||||
text += (
|
||||
indent
|
||||
+ prefix
|
||||
+ render_node(c, text, indent=indent + (' ' * len(prefix)), width=width)
|
||||
)
|
||||
elif n.nodeName in ('para', 'heading'):
|
||||
for c in n.childNodes:
|
||||
text += render_node(c, text, indent=indent, width=width)
|
||||
@ -693,7 +693,8 @@ def gen_docs(config):
|
||||
for filename in CONFIG[mode]['section_order']:
|
||||
if filename not in sections:
|
||||
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)
|
||||
i += 1
|
||||
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')
|
||||
else:
|
||||
func_start_linenum = end_linenum + 1
|
||||
while not clean_lines.lines[func_start_linenum] == '{':
|
||||
attrline = Match(r'^((?!# *define).*?)(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+(?:\(\d+(, \d+)*\))?',
|
||||
clean_lines.lines[func_start_linenum])
|
||||
while not clean_lines.lines[func_start_linenum] == "{":
|
||||
attrline = Match(
|
||||
r'^((?!# *define).*?)'
|
||||
r'(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+'
|
||||
r'(?:\(\d+(, \d+)*\))?',
|
||||
clean_lines.lines[func_start_linenum],
|
||||
)
|
||||
if attrline:
|
||||
if len(attrline.group(1)) != 2:
|
||||
error(filename, func_start_linenum,
|
||||
@ -3182,7 +3186,8 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
|
||||
r'|li_(?:next|prev|tv))\b', line)
|
||||
if match:
|
||||
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
|
||||
# } if (a == b) {
|
||||
|
@ -8,6 +8,7 @@ import locale
|
||||
import io
|
||||
import sys
|
||||
|
||||
|
||||
def set_output_encoding(enc=None):
|
||||
"""Set the encoding of stdout and stderr
|
||||
|
||||
@ -20,7 +21,7 @@ def set_output_encoding(enc=None):
|
||||
|
||||
def get_text_writer(fo, **kwargs):
|
||||
kw = dict(kwargs)
|
||||
kw.setdefault('errors', 'backslashreplace') # use \uXXXX style
|
||||
kw.setdefault('errors', 'backslashreplace') # use \uXXXX style
|
||||
kw.setdefault('closefd', False)
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
@ -29,6 +30,7 @@ def set_output_encoding(enc=None):
|
||||
writer = io.open(fo.fileno(), mode='w', newline='', **kw)
|
||||
write = writer.write # save the original write() function
|
||||
enc = locale.getpreferredencoding()
|
||||
|
||||
def convwrite(s):
|
||||
if isinstance(s, bytes):
|
||||
write(s.decode(enc)) # convert to unistr
|
||||
|
Loading…
Reference in New Issue
Block a user