No need to assign the results of expressions used only for side effects.
diff --git a/Lib/UserDict.py b/Lib/UserDict.py
index 0497f65..bd64f84 100644
--- a/Lib/UserDict.py
+++ b/Lib/UserDict.py
@@ -98,7 +98,7 @@
yield k
def has_key(self, key):
try:
- value = self[key]
+ self[key]
except KeyError:
return False
return True
diff --git a/Lib/genericpath.py b/Lib/genericpath.py
index 73d7b26..a0bf601 100644
--- a/Lib/genericpath.py
+++ b/Lib/genericpath.py
@@ -15,7 +15,7 @@
def exists(path):
"""Test whether a path exists. Returns False for broken symbolic links"""
try:
- st = os.stat(path)
+ os.stat(path)
except os.error:
return False
return True
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index aead656..e6f72ae 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -546,7 +546,6 @@
if __name__ == '__main__':
- import sys
import getopt
USAGE = """\
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 297b68e..6be031b 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -139,7 +139,7 @@
def lexists(path):
"""Test whether a path exists. Returns True for broken symbolic links"""
try:
- st = os.lstat(path)
+ os.lstat(path)
except os.error:
return False
return True
diff --git a/Lib/rexec.py b/Lib/rexec.py
index 22b1bb2..7446151 100644
--- a/Lib/rexec.py
+++ b/Lib/rexec.py
@@ -244,7 +244,7 @@
m.open = m.file = self.r_open
def make_main(self):
- m = self.add_module('__main__')
+ self.add_module('__main__')
def make_osname(self):
osname = os.name
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index f63e719..2a4c156 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -920,7 +920,7 @@
"""Wait for child process to terminate. Returns returncode
attribute."""
if self.returncode is None:
- obj = WaitForSingleObject(self._handle, INFINITE)
+ WaitForSingleObject(self._handle, INFINITE)
self.returncode = GetExitCodeProcess(self._handle)
return self.returncode
diff --git a/Lib/threading.py b/Lib/threading.py
index 4f6ec4b..5674010 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -10,7 +10,6 @@
import warnings
-from functools import wraps
from time import time as _time, sleep as _sleep
from traceback import format_exc as _format_exc
from collections import deque
diff --git a/Lib/urllib.py b/Lib/urllib.py
index 0951237..d4740e9 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -234,7 +234,7 @@
hdrs = fp.info()
fp.close()
return url2pathname(splithost(url1)[1]), hdrs
- except IOError, msg:
+ except IOError:
pass
fp = self.open(url, data)
try:
@@ -1277,7 +1277,7 @@
else:
try:
# is this a sufficient test for sequence-ness?
- x = len(v)
+ len(v)
except TypeError:
# not a sequence
v = quote_plus(str(v))