Commit 2099aa25 authored by Millian Poquet's avatar Millian Poquet
Browse files

[test tools] codacy: avoid using 'dir' in python

parent 69560a27
......@@ -6,10 +6,11 @@ import os
import shutil
def clean_output_directory(dir):
def clean_output_directory(directory):
"""Clean an output directory."""
if os.path.isdir(dir):
subdirs = [dir + '/' + x for x in ['instances', 'sweeper', 'results']]
if os.path.isdir(directory):
subdirs = [directory + '/' + x for x in ['instances', 'sweeper',
'results']]
for subdir in subdirs:
if os.path.isdir(subdir):
shutil.rmtree(subdir)
......
......@@ -6,21 +6,22 @@ import os
import sys
def looks_like_batsim_dir(dir):
def looks_like_batsim_dir(directory):
"""Return whether the directory looks like Batsim root directory."""
if os.path.isdir(dir):
subdirs = [dir + '/' + x for x in ['cmake', 'platforms',
'schedulers', 'src', 'tools']]
if os.path.isdir(directory):
subdirs = [directory + '/' + x for x in ['cmake', 'platforms',
'schedulers', 'src', 'tools']]
for subdir in subdirs:
if not os.path.isdir(subdir):
print("Directory '{dir}' does not look like the "
"Batsim root one : the '{subdir}' subdirectory does not "
"exist.".format(dir=dir, subdir=subdir))
"exist.".format(dir=directory, subdir=subdir))
return False
print("Directory '{}' looks like the Batsim root one".format(dir))
print("Directory '{}' looks like the Batsim root one"
.format(directory))
return True
else:
print("Directory '{dir}' does not exist!", dir)
print("Directory '{dir}' does not exist!", dir=directory)
return False
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment