pep8: trivial fixes

Closes #161 (GH)
This commit is contained in:
Christoph Gysin
2014-11-05 22:31:39 +02:00
committed by Jakub Stasiak
parent 23beb7d43e
commit a70b4ba483
4 changed files with 6 additions and 6 deletions

View File

@@ -473,7 +473,7 @@ class HttpProtocol(BaseHTTPServer.BaseHTTPRequestHandler):
tb = traceback.format_exc()
self.server.log_message(tb)
if not headers_set:
err_body =six.b(tb) if self.server.debug else b''
err_body = six.b(tb) if self.server.debug else b''
start_response("500 Internal Server Error",
[('Content-type', 'text/plain'),
('Content-length', len(err_body))])

View File

@@ -104,7 +104,7 @@ class TestGreenSocket(LimitedTestCase):
s.settimeout(0.1)
gs = greenio.GreenSocket(s)
e = gs.connect_ex(('192.0.2.1', 80))
if not e in (errno.EHOSTUNREACH, errno.ENETUNREACH):
if e not in (errno.EHOSTUNREACH, errno.ENETUNREACH):
self.assertEqual(e, errno.EAGAIN)
def test_recv_timeout(self):

View File

@@ -21,12 +21,12 @@ def _VmB(VmKey):
t.close()
except:
return 0.0 # non-Linux?
# get VmKey line e.g. 'VmRSS: 9999 kB\n ...'
# get VmKey line e.g. 'VmRSS: 9999 kB\n ...'
i = v.index(VmKey)
v = v[i:].split(None, 3) # whitespace
if len(v) < 3:
return 0.0 # invalid format?
# convert Vm value to bytes
# convert Vm value to bytes
return float(v[1]) * _scale[v[2]]

View File

@@ -306,7 +306,7 @@ def _set_signature(mock, original, instance=False):
src = """def %s(*args, **kwargs):
_checksig_(*args, **kwargs)
return mock(*args, **kwargs)""" % name
exec (src, context)
exec(src, context)
funcopy = context[name]
_setup_func(funcopy, mock)
return funcopy
@@ -336,7 +336,7 @@ def _setup_func(funcopy, mock):
funcopy.mock_calls = _CallList()
mock.reset_mock()
ret = funcopy.return_value
if _is_instance_mock(ret) and not ret is mock:
if _is_instance_mock(ret) and ret is not mock:
ret.reset_mock()
funcopy.called = False