From 87a94676cc29baca9cd6f1456bb9501f81cef52a Mon Sep 17 00:00:00 2001 From: Guillaume Chazarain Date: Sun, 10 Apr 2011 15:21:25 +0200 Subject: [PATCH] Address some pyflakes and pychecker warnings --- iotop/data.py | 2 -- iotop/genetlink.py | 3 ++- iotop/ioprio.py | 1 - iotop/netlink.py | 6 +++--- iotop/ui.py | 2 -- iotop/vmstat.py | 2 -- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/iotop/data.py b/iotop/data.py index 41f23dd..e7d84e6 100644 --- a/iotop/data.py +++ b/iotop/data.py @@ -17,11 +17,9 @@ # Copyright (c) 2007 Guillaume Chazarain import errno -import glob import os import pprint import pwd -import socket import stat import struct import sys diff --git a/iotop/genetlink.py b/iotop/genetlink.py index 0e4f954..f9abf15 100644 --- a/iotop/genetlink.py +++ b/iotop/genetlink.py @@ -7,7 +7,8 @@ GPLv2+; See copying for details. ''' import struct -from netlink import * +from netlink import NLM_F_REQUEST, NLMSG_MIN_TYPE, Message, parse_attributes +from netlink import NulStrAttr, Connection, NETLINK_GENERIC CTRL_CMD_UNSPEC = 0 CTRL_CMD_NEWFAMILY = 1 diff --git a/iotop/ioprio.py b/iotop/ioprio.py index 56981b4..86a729f 100644 --- a/iotop/ioprio.py +++ b/iotop/ioprio.py @@ -20,7 +20,6 @@ import ctypes import fnmatch import os import platform -import time # From http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob; # f=configure.ac;h=770eb45ae85d32757fc3cff1d70a7808a627f9f7;hb=HEAD#l354 diff --git a/iotop/netlink.py b/iotop/netlink.py index 465319e..326045a 100644 --- a/iotop/netlink.py +++ b/iotop/netlink.py @@ -6,7 +6,9 @@ Copyright 2007 Johannes Berg GPLv2+; See copying for details. ''' -import struct, socket +import os +import socket +import struct try: # try to use python 2.5's netlink support @@ -36,7 +38,6 @@ except socket.error: except ImportError: # or fall back to the ctypes module import ctypes - import os libc = ctypes.CDLL(None) @@ -220,7 +221,6 @@ class Connection: msg = Message(msg_type, flags, seq, contents[16:]) msg.pid = pid if msg.type == NLMSG_ERROR: - import os errno = -struct.unpack("i", msg.payload[:4])[0] if errno != 0: err = OSError("Netlink error: %s (%d)" % ( diff --git a/iotop/ui.py b/iotop/ui.py index c2e44f2..8c0e5af 100644 --- a/iotop/ui.py +++ b/iotop/ui.py @@ -22,9 +22,7 @@ import locale import math import optparse import os -import pwd import select -import struct import sys import time diff --git a/iotop/vmstat.py b/iotop/vmstat.py index ba5e929..0b73436 100644 --- a/iotop/vmstat.py +++ b/iotop/vmstat.py @@ -16,8 +16,6 @@ # # Copyright (c) 2007 Guillaume Chazarain -import os - class VmStat(object): def __init__(self): self.vmstat_file = open('/proc/vmstat') -- 2.11.4.GIT