Skip to content

Commit 522b4eb

Browse files
committed
[roottest] Implement Python linter suggestions to driveTabCom.py
1 parent 9144e2e commit 522b4eb

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

roottest/root/rint/driveTabCom.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
# Pretend to ROOT that its input is a tty, to enable tab completion.
2-
from __future__ import print_function
3-
import pty, os, subprocess, sys, select
2+
3+
import os
4+
import pty
5+
import select
6+
import subprocess
7+
import sys
48

59
# Create a tty: master is our side, slave is what we pass as Popen's stdin.
610
# This makes ROOT believe that its stdin is a tty.
711
master, slave = pty.openpty()
8-
cmd = ['root.exe', '-b', '-l']
9-
proc = subprocess.Popen(cmd,
10-
stdin = slave,
11-
stdout = slave,
12-
stderr = subprocess.PIPE,
13-
close_fds=True
14-
)
12+
cmd = ["root.exe", "-b", "-l"]
13+
proc = subprocess.Popen(cmd, stdin=slave, stdout=slave, stderr=subprocess.PIPE, close_fds=True)
1514

1615
# Now we need to pass what's on our stdin to ROOT's stdin
1716
# and read what's on the slave's stdout.
1817
while True:
19-
data = os.read(0, 1024);
18+
data = os.read(0, 1024)
2019
if len(data) == 0:
2120
break
22-
#ret = master_stdin.write(data)
21+
# ret = master_stdin.write(data)
2322
os.write(master, data)
24-
while select.select([master],[],[],1.0)[0]:
23+
while select.select([master], [], [], 1.0)[0]:
2524
os.write(1, os.read(master, 1))
2625

2726
# Wait until the subprocess has exited...
@@ -31,12 +30,11 @@
3130
out, err = proc.communicate()
3231

3332
# Then write the subprocess's output to our output streams.
34-
#sys.stdout.write(out.decode('utf-8'))
35-
sys.stderr.write(err.decode('utf-8'))
33+
# sys.stdout.write(out.decode('utf-8'))
34+
sys.stderr.write(err.decode("utf-8"))
3635

3736
# No need to wait; the subprocess is dead.
38-
while select.select([master],[],[],0.0)[0]:
39-
sys.stdout.write(os.read(master, 1).decode('utf-8'))
37+
while select.select([master], [], [], 0.0)[0]:
38+
sys.stdout.write(os.read(master, 1).decode("utf-8"))
4039

4140
exit(proc.returncode)
42-

0 commit comments

Comments
 (0)