[ovs-dev] [PATCH 02/11] python: Remove unused imports and variables.

Russell Bryant russell at ovn.org
Tue Dec 22 17:17:24 UTC 2015


This resolves the following flake8 error types:

  F841 local variable 'e' is assigned to but never used
  F401 'exceptions' imported but unused

Signed-off-by: Russell Bryant <russell at ovn.org>
---
 Makefile.am                                           | 2 +-
 debian/ovs-monitor-ipsec                              | 1 -
 python/ovs/socket_util.py                             | 5 ++---
 python/ovs/unixctl/client.py                          | 2 --
 python/ovstest/vswitch.py                             | 3 ---
 tests/test-daemon.py                                  | 1 -
 tests/test-ovsdb.py                                   | 1 -
 vtep/ovs-vtep                                         | 2 +-
 xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync | 2 --
 9 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c08489d..5eec332 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -342,7 +342,7 @@ endif
 if HAVE_FLAKE8
 ALL_LOCAL += pep8-check
 pep8-check: $(FLAKE8_PYFILES)
-	if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,F401,F811,F821,F841,W601; then touch $@; else exit 1; fi
+	if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,F811,F821,W601; then touch $@; else exit 1; fi
 endif
 
 include $(srcdir)/manpages.mk
diff --git a/debian/ovs-monitor-ipsec b/debian/ovs-monitor-ipsec
index d35ec46..50b3013 100755
--- a/debian/ovs-monitor-ipsec
+++ b/debian/ovs-monitor-ipsec
@@ -33,7 +33,6 @@ import sys
 
 import ovs.dirs
 from ovs.db import error
-from ovs.db import types
 import ovs.util
 import ovs.daemon
 import ovs.db.idl
diff --git a/python/ovs/socket_util.py b/python/ovs/socket_util.py
index f657d11..7b943cf 100644
--- a/python/ovs/socket_util.py
+++ b/python/ovs/socket_util.py
@@ -16,7 +16,6 @@ import errno
 import os
 import os.path
 import random
-import select
 import socket
 import sys
 
@@ -302,12 +301,12 @@ def set_dscp(sock, family, dscp):
     if family == socket.AF_INET:
         try:
             sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, val)
-        except socket.error, e:
+        except socket.error:
             raise
     elif family == socket.AF_INET6:
         try:
             sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_TCLASS, val)
-        except socket.error, e:
+        except socket.error:
             raise
     else:
         raise
diff --git a/python/ovs/unixctl/client.py b/python/ovs/unixctl/client.py
index 2176009..be6dee4 100644
--- a/python/ovs/unixctl/client.py
+++ b/python/ovs/unixctl/client.py
@@ -12,8 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import copy
-import errno
 import os
 import types
 
diff --git a/python/ovstest/vswitch.py b/python/ovstest/vswitch.py
index dd315e5..be66a2e 100644
--- a/python/ovstest/vswitch.py
+++ b/python/ovstest/vswitch.py
@@ -15,9 +15,6 @@
 """
 vswitch module allows its callers to interact with OVS DB.
 """
-import exceptions
-import subprocess
-
 import util
 
 
diff --git a/tests/test-daemon.py b/tests/test-daemon.py
index b759cf9..63c1f70 100644
--- a/tests/test-daemon.py
+++ b/tests/test-daemon.py
@@ -13,7 +13,6 @@
 # limitations under the License.
 
 import argparse
-import logging
 import signal
 import sys
 import time
diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
index a6897f3..6ddc6b4 100644
--- a/tests/test-ovsdb.py
+++ b/tests/test-ovsdb.py
@@ -389,7 +389,6 @@ def idl_set(idl, commands, step):
 def do_idl(schema_file, remote, *commands):
     schema_helper = ovs.db.idl.SchemaHelper(schema_file)
     if commands and commands[0].startswith("?"):
-        monitor = {}
         readonly = {}
         for x in commands[0][1:].split("?"):
             readonly = []
diff --git a/vtep/ovs-vtep b/vtep/ovs-vtep
index 3244520..9b6799e 100755
--- a/vtep/ovs-vtep
+++ b/vtep/ovs-vtep
@@ -641,7 +641,7 @@ def setup():
             for port in bfd_ports:
                 remote_ip = ovs_vsctl("get interface %s options:remote_ip"
                                       % port)
-                tunnel = destroy_vtep_tunnel(remote_ip)
+                destroy_vtep_tunnel(remote_ip)
 
             ovs_vsctl("del-br %s" % br)
 
diff --git a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
index f5c38be..cb1f175 100755
--- a/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
+++ b/xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync
@@ -30,8 +30,6 @@ import time
 import XenAPI
 
 import ovs.dirs
-from ovs.db import error
-from ovs.db import types
 import ovs.daemon
 import ovs.db.idl
 import ovs.unixctl
-- 
2.5.0




More information about the dev mailing list