Skip to content

Commit 6d07f1c

Browse files
committed
Fix some pylint complaints
1 parent 1b5e357 commit 6d07f1c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def compare_unittests(args):
226226

227227

228228
def run_cpython_test(args):
229-
import glob
230229
interp_args = []
231230
globs = []
232231
test_args = []
@@ -511,7 +510,8 @@ def graalpytest(args):
511510
return do_run_python(cmd_args)
512511

513512

514-
def _list_graalpython_unittests(paths=None, exclude=[]):
513+
def _list_graalpython_unittests(paths=None, exclude=None):
514+
exclude = [] if exclude is None else exclude
515515
paths = paths or [_graalpytest_root()]
516516
def is_included(path):
517517
if path.endswith(".py"):
@@ -1708,7 +1708,7 @@ def build(self):
17081708
args += ["--python.WithThread",
17091709
"--python.PyCachePrefix=" + pycache_dir,
17101710
"-B",
1711-
"-S", os.path.join(self.src_dir() , "setup.py"),
1711+
"-S", os.path.join(self.src_dir(), "setup.py"),
17121712
self.subject.get_output_root()]
17131713
mx.ensure_dir_exists(cwd)
17141714
rc = self.run(args, cwd=cwd)
@@ -1842,21 +1842,21 @@ def checkout_find_version_for_graalvm(args):
18421842
orig_clean = mx.command_function("clean")
18431843
def python_clean(args):
18441844
orig_clean(args)
1845-
count = 0;
1845+
count = 0
18461846
for path in os.walk(SUITE.dir):
18471847
for file in glob.iglob(os.path.join(path[0], '*.pyc')):
18481848
count += 1
18491849
os.remove(file)
18501850

18511851
if count > 0:
1852-
print ('Cleaning', count, "`*.pyc` files...")
1852+
print('Cleaning', count, "`*.pyc` files...")
18531853

18541854
def update_hpy_import_cmd(args):
18551855
"""Update our import of HPy sources."""
18561856
parser = ArgumentParser('mx python-update-hpy-import')
18571857
parser.add_argument('--pull', action='store_true', help='Perform a pull of the HPy repo first.', required=False)
18581858
parser.add_argument('hpy_repo', metavar='HPY_REPO', help='Path to the HPy repo to import from.')
1859-
parsed_args, remaining_args = parser.parse_known_args(args)
1859+
parsed_args, _ = parser.parse_known_args(args)
18601860

18611861
join = os.path.join
18621862
vc = SUITE.vc
@@ -1901,7 +1901,7 @@ def update_hpy_import_cmd(args):
19011901

19021902
def import_files(from_dir, to_dir):
19031903
mx.log("Importing HPy files from {}".format(from_dir))
1904-
for dirpath, dirnames, filenames in os.walk(from_dir):
1904+
for dirpath, _, filenames in os.walk(from_dir):
19051905
relative_dir_path = os.path.relpath(dirpath, start=from_dir)
19061906
# ignore dir 'cpython' and all its subdirs
19071907
for filename in filenames:

mx.graalpython/mx_graalpython_benchmark.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ def override_iterations(self, requested_iterations):
259259
def interpreter(self):
260260
try:
261261
return subprocess.check_output("which %s" % JythonVm.JYTHON_INTERPRETER, shell=True).decode().strip()
262-
except OSError:
263-
mx.abort("{} is not set!".format(ENV_JYTHON_HOME))
264-
return join(home, 'bin', JythonVm.JYTHON_INTERPRETER)
262+
except OSError as e:
263+
mx.log_error(e)
264+
mx.abort("Error when executing `which jython`!\n")
265265

266266
def name(self):
267267
return VM_NAME_JYTHON
@@ -485,7 +485,7 @@ def postprocess_run_args(self, run_args):
485485
if not arg.startswith("-"):
486486
remaining = run_args[i:]
487487
break
488-
elif arg.startswith("-i"):
488+
if arg.startswith("-i"):
489489
if len(run_args) >= i and run_args[i + 1] == "-1":
490490
pass
491491
else:

0 commit comments

Comments
 (0)