From: Russell Bryant Date: Tue, 22 Dec 2015 15:43:24 +0000 (-0500) Subject: python: Remove unused imports and variables. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=5697ca99019c1bf63a7df914554138b753fae886 python: Remove unused imports and variables. 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 Acked-by: Ben Pfaff --- diff --git a/Makefile.am b/Makefile.am index 52db24493..50999e5c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -343,7 +343,7 @@ endif if HAVE_FLAKE8 ALL_LOCAL += flake8-check flake8-check: $(FLAKE8_PYFILES) - $(AM_V_GEN) 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 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi + $(AM_V_GEN) 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 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi endif include $(srcdir)/manpages.mk diff --git a/debian/ovs-monitor-ipsec b/debian/ovs-monitor-ipsec index d35ec4607..50b3013e4 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 f657d11c8..04fb6afce 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 @@ -300,14 +299,8 @@ def set_dscp(sock, family, dscp): val = dscp << 2 if family == socket.AF_INET: - try: - sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, val) - except socket.error, e: - raise + sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, val) elif family == socket.AF_INET6: - try: - sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_TCLASS, val) - except socket.error, e: - raise + sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_TCLASS, val) else: - raise + raise ValueError('Invalid family %d' % family) diff --git a/python/ovs/unixctl/client.py b/python/ovs/unixctl/client.py index 2176009ac..be6dee4dd 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 dd315e5ca..be66a2ebd 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 b759cf955..63c1f708d 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 a6897f347..6ddc6b4f3 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 324452060..9b6799e33 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 f5c38be5c..cb1f175a6 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