Skip to content

Commit 1d72166

Browse files
committed
Fix pylint warnings in autograde_wrapper.py
1 parent 6aca17e commit 1d72166

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

autodriver/autograde_wrapper.py

+21-20
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,34 @@
1212
# interesting process exits
1313
class WaitLoop(object):
1414
def __init__(self, pid=None):
15-
self.waitfor=pid
16-
self.status=None
15+
self.waitfor = pid
16+
self.status = None
1717
def __call__(self):
1818
try:
19-
(np, self.status)=os.wait()
20-
while np is None or np != self.waitfor:
21-
(np, self.status)=os.wait()
19+
(nextpid, self.status) = os.wait()
20+
while nextpid is None or nextpid != self.waitfor:
21+
(nextpid, self.status) = os.wait()
2222
except OSError:
23-
if np:
24-
print("Chld process {} never exited, but no more children left".format(self.waitfor))
25-
self.status=-1
23+
if nextpid:
24+
print("Chld process {} never exited, but no more children left".
25+
format(self.waitfor))
26+
self.status = -1
2627

2728
def main():
28-
for f in os.listdir("mount"):
29-
src=os.path.join("mount", f)
30-
dst=os.path.join("autolab", f)
29+
for copyfile in os.listdir("mount"):
30+
src = os.path.join("mount", copyfile)
31+
dst = os.path.join("autolab", copyfile)
3132
shutil.copy(src, dst)
3233

33-
autolabuser=pwd.getpwnam("autolab")
34-
(r_p, w_p)=os.pipe()
35-
pid=os.fork()
34+
autolabuser = pwd.getpwnam("autolab")
35+
(r_p, w_p) = os.pipe()
36+
pid = os.fork()
3637
if pid == 0:
3738
os.close(r_p)
3839
os.setgroups([])
3940
os.setgid(autolabuser.pw_gid)
4041
os.setuid(autolabuser.pw_uid)
41-
args=["autodriver"]
42+
args = ["autodriver"]
4243
args.extend(sys.argv[1:])
4344
args.append("autolab")
4445
if w_p != 1:
@@ -49,19 +50,19 @@ def main():
4950
os.close(w_p)
5051
os.execvp(args[0], args)
5152
os.close(w_p)
52-
waiter=WaitLoop(pid)
53-
thr=threading.Thread(target=waiter)
53+
waiter = WaitLoop(pid)
54+
thr = threading.Thread(target=waiter)
5455
thr.start()
55-
rpf=os.fdopen(r_p)
56+
rpf = os.fdopen(r_p)
5657
shutil.copyfileobj(rpf, open("mount/feedback", "w"))
5758
#print("Copied output")
5859
rpf.close()
5960
thr.join()
6061
# if core, exit -1, else pass through code.
6162
if os.WIFSIGNALED(waiter.status):
62-
status=-1
63+
status = -1
6364
else:
64-
status=os.WEXITSTATUS(waiter.status)
65+
status = os.WEXITSTATUS(waiter.status)
6566
#print("Status is {}".format(status))
6667
sys.exit(status)
6768

0 commit comments

Comments
 (0)