mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
No need to assign the results of expressions used only for side effects.
This commit is contained in:
parent
7d4b759bd9
commit
84fedf7f06
8 changed files with 7 additions and 9 deletions
|
@ -98,7 +98,7 @@ class DictMixin:
|
||||||
yield k
|
yield k
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
try:
|
try:
|
||||||
value = self[key]
|
self[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -15,7 +15,7 @@ __all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',
|
||||||
def exists(path):
|
def exists(path):
|
||||||
"""Test whether a path exists. Returns False for broken symbolic links"""
|
"""Test whether a path exists. Returns False for broken symbolic links"""
|
||||||
try:
|
try:
|
||||||
st = os.stat(path)
|
os.stat(path)
|
||||||
except os.error:
|
except os.error:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -546,7 +546,6 @@ _default_mime_types()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
|
||||||
import getopt
|
import getopt
|
||||||
|
|
||||||
USAGE = """\
|
USAGE = """\
|
||||||
|
|
|
@ -139,7 +139,7 @@ def islink(path):
|
||||||
def lexists(path):
|
def lexists(path):
|
||||||
"""Test whether a path exists. Returns True for broken symbolic links"""
|
"""Test whether a path exists. Returns True for broken symbolic links"""
|
||||||
try:
|
try:
|
||||||
st = os.lstat(path)
|
os.lstat(path)
|
||||||
except os.error:
|
except os.error:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -244,7 +244,7 @@ class RExec(ihooks._Verbose):
|
||||||
m.open = m.file = self.r_open
|
m.open = m.file = self.r_open
|
||||||
|
|
||||||
def make_main(self):
|
def make_main(self):
|
||||||
m = self.add_module('__main__')
|
self.add_module('__main__')
|
||||||
|
|
||||||
def make_osname(self):
|
def make_osname(self):
|
||||||
osname = os.name
|
osname = os.name
|
||||||
|
|
|
@ -920,7 +920,7 @@ class Popen(object):
|
||||||
"""Wait for child process to terminate. Returns returncode
|
"""Wait for child process to terminate. Returns returncode
|
||||||
attribute."""
|
attribute."""
|
||||||
if self.returncode is None:
|
if self.returncode is None:
|
||||||
obj = WaitForSingleObject(self._handle, INFINITE)
|
WaitForSingleObject(self._handle, INFINITE)
|
||||||
self.returncode = GetExitCodeProcess(self._handle)
|
self.returncode = GetExitCodeProcess(self._handle)
|
||||||
return self.returncode
|
return self.returncode
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ except ImportError:
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from functools import wraps
|
|
||||||
from time import time as _time, sleep as _sleep
|
from time import time as _time, sleep as _sleep
|
||||||
from traceback import format_exc as _format_exc
|
from traceback import format_exc as _format_exc
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
|
@ -234,7 +234,7 @@ class URLopener:
|
||||||
hdrs = fp.info()
|
hdrs = fp.info()
|
||||||
fp.close()
|
fp.close()
|
||||||
return url2pathname(splithost(url1)[1]), hdrs
|
return url2pathname(splithost(url1)[1]), hdrs
|
||||||
except IOError, msg:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
fp = self.open(url, data)
|
fp = self.open(url, data)
|
||||||
try:
|
try:
|
||||||
|
@ -1277,7 +1277,7 @@ def urlencode(query,doseq=0):
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# is this a sufficient test for sequence-ness?
|
# is this a sufficient test for sequence-ness?
|
||||||
x = len(v)
|
len(v)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# not a sequence
|
# not a sequence
|
||||||
v = quote_plus(str(v))
|
v = quote_plus(str(v))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue