]> granicus.if.org Git - python/commitdiff
No need to assign the results of expressions used only for side effects.
authorGeorg Brandl <georg@python.org>
Sat, 6 Feb 2010 22:59:15 +0000 (22:59 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 6 Feb 2010 22:59:15 +0000 (22:59 +0000)
Lib/UserDict.py
Lib/genericpath.py
Lib/mimetypes.py
Lib/posixpath.py
Lib/rexec.py
Lib/subprocess.py
Lib/threading.py
Lib/urllib.py

index 0497f65d1db000e7cf41b90939eff79c85cf9b83..bd64f84d4252866eaf61840617fb748363798bc2 100644 (file)
@@ -98,7 +98,7 @@ class DictMixin:
             yield k
     def has_key(self, key):
         try:
-            value = self[key]
+            self[key]
         except KeyError:
             return False
         return True
index 73d7b26b3e27a137a1ff7897bb3143d5b7fd75bd..a0bf6013e93763ab87895a561117f25cf641af72 100644 (file)
@@ -15,7 +15,7 @@ __all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',
 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
index aead6566a5838daceeafc3e8f207fac924c9a366..e6f72aeccc13875acadd1c3af67c2c7760f476bf 100644 (file)
@@ -546,7 +546,6 @@ _default_mime_types()
 
 
 if __name__ == '__main__':
-    import sys
     import getopt
 
     USAGE = """\
index 297b68ea34a88087eb75faed19c2d7a015408fd7..6be031b3427071e1727f46bffa72c1146b554bb2 100644 (file)
@@ -139,7 +139,7 @@ def islink(path):
 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
index 22b1bb26228897dda6df1439cde6d8aba1e17b66..74461512ddcb35680f360a98941b17b90e972a75 100644 (file)
@@ -244,7 +244,7 @@ class RExec(ihooks._Verbose):
         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
index f63e719d7b72f75af423ba1a6ccb324be86976eb..2a4c1567aa830d9606eef2726ae7bd4b9be5eed4 100644 (file)
@@ -920,7 +920,7 @@ class Popen(object):
             """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
 
index 4f6ec4b18695135eba60e5ed807686f23ada0219..56740101edb8ae5cde5a6c86129f0d73d5d63fa0 100644 (file)
@@ -10,7 +10,6 @@ except ImportError:
 
 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
index 095123755770117c09eb5505425b71435e0b2c69..d4740e97a79ff7d1e12ed6244989252282c0abbc 100644 (file)
@@ -234,7 +234,7 @@ class URLopener:
                 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 @@ def urlencode(query,doseq=0):
             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))