pylint: turn on superfluous parens warning

Which is really useful for catching parens used with keywords like
assert. Don't use parens with assert, it's bad.
pull/9174/head
Dylan Baker 4 years ago committed by Eli Schwartz
parent 278942a447
commit 06fdb29daa
  1. 1
      .pylintrc
  2. 4
      mesonbuild/mdist.py
  3. 12
      mesonbuild/rewriter.py

@ -22,6 +22,7 @@ enable=
no-value-for-parameter,
redundant-keyword-arg,
singleton-comparison,
superfluous-parens,
too-many-function-args,
unexpected-keyword-arg,
unneeded-not,

@ -83,7 +83,7 @@ def process_submodules(dirname):
def run_dist_scripts(src_root, bld_root, dist_root, dist_scripts, subprojects):
assert(os.path.isabs(dist_root))
assert os.path.isabs(dist_root)
env = {}
env['MESON_DIST_ROOT'] = dist_root
env['MESON_SOURCE_ROOT'] = src_root
@ -243,7 +243,7 @@ def check_dist(packagename, meson_command, extra_meson_args, bld_root, privdir):
ninja_args = detect_ninja()
shutil.unpack_archive(packagename, unpackdir)
unpacked_files = glob(os.path.join(unpackdir, '*'))
assert(len(unpacked_files) == 1)
assert len(unpacked_files) == 1
unpacked_src_dir = unpacked_files[0]
with open(os.path.join(bld_root, 'meson-info', 'intro-buildoptions.json'), encoding='utf-8') as boptions:
meson_command += ['-D{name}={value}'.format(**o) for o in json.load(boptions)

@ -76,7 +76,7 @@ class RequiredKeys:
def __call__(self, f):
@wraps(f)
def wrapped(*wrapped_args, **wrapped_kwargs):
assert(len(wrapped_args) >= 2)
assert len(wrapped_args) >= 2
cmd = wrapped_args[1]
for key, val in self.keys.items():
typ = val[0] # The type of the value
@ -92,7 +92,7 @@ class RequiredKeys:
raise RewriterException('Invalid type of "{}". Required is {} but provided was {}'
.format(key, typ.__name__, type(cmd[key]).__name__))
if choices is not None:
assert(isinstance(choices, list))
assert isinstance(choices, list)
if cmd[key] not in choices:
raise RewriterException('Invalid value of "{}": Possible values are {} but provided was "{}"'
.format(key, choices, cmd[key]))
@ -521,8 +521,8 @@ class Rewriter:
arg_node = node.args
if not node:
mlog.error('Unable to find the function node')
assert(isinstance(node, FunctionNode))
assert(isinstance(arg_node, ArgumentNode))
assert isinstance(node, FunctionNode)
assert isinstance(arg_node, ArgumentNode)
# Transform the key nodes to plain strings
arg_node.kwargs = {k.value: v for k, v in arg_node.kwargs.items()}
@ -640,7 +640,7 @@ class Rewriter:
node = target['sources'][0]
else:
node = target['node']
assert(node is not None)
assert node is not None
# Generate the current source list
src_list = []
@ -666,7 +666,7 @@ class Rewriter:
arg_node = node.args
elif isinstance(node, ArgumentNode):
arg_node = node
assert(arg_node is not None)
assert arg_node is not None
arg_node.arguments += to_append
# Mark the node as modified

Loading…
Cancel
Save