[2/5] test/inhfd: fix lint warnings

Submitted by Andrey Vagin on Sept. 20, 2018, 10:22 p.m.

Details

Message ID 20180920221817.29697-3-avagin@virtuozzo.com
State Accepted
Series "files: save inherited file descriptors in fdstore"
Headers show

Commit Message

Andrey Vagin Sept. 20, 2018, 10:22 p.m.
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
---
 test/inhfd/fifo.py   | 18 +++++++++++-------
 test/inhfd/pipe.py   |  5 ++++-
 test/inhfd/socket.py |  4 ++++
 test/inhfd/tty.py    | 10 ++++++++--
 4 files changed, 27 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/test/inhfd/fifo.py b/test/inhfd/fifo.py
index 11703e1c0..bd4017ec4 100755
--- a/test/inhfd/fifo.py
+++ b/test/inhfd/fifo.py
@@ -1,7 +1,9 @@ 
-import os, tempfile
+import os
+import tempfile
 
 id_str = ""
 
+
 def create_fds():
 	tdir = tempfile.mkdtemp("zdtm.inhfd.XXXXXX")
 	if os.system("mount -t tmpfs zdtm.inhfd %s" % tdir) != 0:
@@ -13,12 +15,12 @@  def create_fds():
 	os.system("umount -l %s" % tdir)
 	os.rmdir(tdir)
 
-	mnt_id = -1;
+	mnt_id = -1
 	with open("/proc/self/fdinfo/%d" % fd1.fileno()) as f:
-		for l in f:
-			l = l.split()
-			if l[0] == "mnt_id:":
-				mnt_id = int(l[1])
+		for line in f:
+			line = line.split()
+			if line[0] == "mnt_id:":
+				mnt_id = int(line[1])
 				break
 		else:
 			raise Exception("Unable to find mnt_id")
@@ -28,8 +30,10 @@  def create_fds():
 
 	return (fd2, fd1)
 
+
 def filename(pipef):
 	return id_str
 
+
 def dump_opts(sockf):
-	return [ "--external", id_str ]
+	return ["--external", id_str]
diff --git a/test/inhfd/pipe.py b/test/inhfd/pipe.py
index 0f9115246..4635a6cc1 100755
--- a/test/inhfd/pipe.py
+++ b/test/inhfd/pipe.py
@@ -1,11 +1,14 @@ 
 import os
 
+
 def create_fds():
 	(fd1, fd2) = os.pipe()
 	return (os.fdopen(fd2, "wb"), os.fdopen(fd1, "rb"))
 
+
 def filename(pipef):
 	return 'pipe:[%d]' % os.fstat(pipef.fileno()).st_ino
 
+
 def dump_opts(sockf):
-	return [ ]
+	return []
diff --git a/test/inhfd/socket.py b/test/inhfd/socket.py
index 45ae03367..d7e434046 100755
--- a/test/inhfd/socket.py
+++ b/test/inhfd/socket.py
@@ -1,15 +1,19 @@ 
 import socket
 import os
 
+
 def create_fds():
 	(sk1, sk2) = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
 	return (sk1.makefile("wb"), sk2.makefile("rb"))
 
+
 def __sock_ino(sockf):
 	return os.fstat(sockf.fileno()).st_ino
 
+
 def filename(sockf):
 	return 'socket:[%d]' % __sock_ino(sockf)
 
+
 def dump_opts(sockf):
 	return ['--external', 'unix[%d]' % __sock_ino(sockf)]
diff --git a/test/inhfd/tty.py b/test/inhfd/tty.py
index fbda13948..519b6bcbc 100755
--- a/test/inhfd/tty.py
+++ b/test/inhfd/tty.py
@@ -1,17 +1,23 @@ 
-import os, pty
-import termios, fcntl
+import fcntl
+import os
+import pty
+import termios
+
 
 def child_prep(fd):
 	fcntl.ioctl(fd.fileno(), termios.TIOCSCTTY, 1)
 
+
 def create_fds():
 	(fd1, fd2) = pty.openpty()
 	return (os.fdopen(fd2, "wb"), os.fdopen(fd1, "rb"))
 
+
 def filename(pipef):
 	st = os.fstat(pipef.fileno())
 	return 'tty[%x:%x]' % (st.st_rdev, st.st_dev)
 
+
 def dump_opts(sockf):
 	st = os.fstat(sockf.fileno())
 	return ["--external", 'tty[%x:%x]' % (st.st_rdev, st.st_dev)]