Commit 2240f483 authored by Jason Madden's avatar Jason Madden

PEP8 cleanup.

parent 955dbc61
[pep8] [pep8]
ignore=E702,E265,E402,E731,E266,E261 ignore=E702,E265,E402,E731,E266,E261,W503
max_line_length=160 max_line_length=160
exclude=.tox,.git,build,2.6,2.7,2.7pypy,3.3,test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py,_sslgte279.py exclude=.tox,.git,build,2.6,2.7,2.7pypy,3.3,test_support.py,test_queue.py,patched_tests_setup.py,test_threading_2.py,lock_tests.py,_sslgte279.py
...@@ -398,6 +398,7 @@ else: ...@@ -398,6 +398,7 @@ else:
if hasattr(__socket__, 'ssl'): if hasattr(__socket__, 'ssl'):
from gevent.hub import PYGTE279 from gevent.hub import PYGTE279
def ssl(sock, keyfile=None, certfile=None): def ssl(sock, keyfile=None, certfile=None):
# deprecated in 2.7.9 but still present # deprecated in 2.7.9 but still present
if PYGTE279: if PYGTE279:
......
...@@ -127,6 +127,7 @@ class BaseServer(object): ...@@ -127,6 +127,7 @@ class BaseServer(object):
def do_handle(self, *args): def do_handle(self, *args):
spawn = self._spawn spawn = self._spawn
handle = self._handle handle = self._handle
def _close_when_done(*args): def _close_when_done(*args):
try: try:
return handle(*args) return handle(*args)
......
...@@ -1058,6 +1058,7 @@ class child(watcher): ...@@ -1058,6 +1058,7 @@ class child(watcher):
def rstatus(self, value): def rstatus(self, value):
self._watcher.rstatus = value self._watcher.rstatus = value
class stat(watcher): class stat(watcher):
_watcher_start = libev.ev_stat_start _watcher_start = libev.ev_stat_start
_watcher_stop = libev.ev_stat_stop _watcher_stop = libev.ev_stat_stop
...@@ -1106,6 +1107,7 @@ class stat(watcher): ...@@ -1106,6 +1107,7 @@ class stat(watcher):
def interval(self): def interval(self):
return self._watcher.interval return self._watcher.interval
def _syserr_cb(msg): def _syserr_cb(msg):
try: try:
msg = ffi.string(msg) msg = ffi.string(msg)
......
...@@ -41,7 +41,7 @@ if PYPY: ...@@ -41,7 +41,7 @@ if PYPY:
# otherwise we get a new DummyThread, which cannot be joined. # otherwise we get a new DummyThread, which cannot be joined.
# Fixes tests in test_threading_2 # Fixes tests in test_threading_2
if _get_ident() not in __threading__._active and len(__threading__._active) == 1: if _get_ident() not in __threading__._active and len(__threading__._active) == 1:
k,v = __threading__._active.items()[0] k, v = __threading__._active.items()[0]
del __threading__._active[k] del __threading__._active[k]
__threading__._active[_get_ident()] = v __threading__._active[_get_ident()] = v
......
...@@ -10,6 +10,7 @@ import util ...@@ -10,6 +10,7 @@ import util
import ssl import ssl
class Test_wsgiserver(util.TestServer): class Test_wsgiserver(util.TestServer):
server = 'wsgiserver.py' server = 'wsgiserver.py'
URL = 'http://127.0.0.1:8088' URL = 'http://127.0.0.1:8088'
......
...@@ -10,7 +10,6 @@ except ImportError as ex: ...@@ -10,7 +10,6 @@ except ImportError as ex:
sys.exit(0) sys.exit(0)
class TestPickle(greentest.TestCase): class TestPickle(greentest.TestCase):
# Issue 104: ares.ares_host_result unpickleable # Issue 104: ares.ares_host_result unpickleable
...@@ -24,7 +23,7 @@ class TestPickle(greentest.TestCase): ...@@ -24,7 +23,7 @@ class TestPickle(greentest.TestCase):
for i in range(0, pickle.HIGHEST_PROTOCOL): for i in range(0, pickle.HIGHEST_PROTOCOL):
def make_test(j): def make_test(j):
return lambda self: self._test(j) return lambda self: self._test(j)
setattr(TestPickle, 'test' + str(i), make_test(i) ) setattr(TestPickle, 'test' + str(i), make_test(i))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -266,6 +266,7 @@ class TestStuff(greentest.TestCase): ...@@ -266,6 +266,7 @@ class TestStuff(greentest.TestCase):
self.assertEqual(e.get(), 1) self.assertEqual(e.get(), 1)
def test_wait_error(self): def test_wait_error(self):
def x(): def x():
sleep(DELAY) sleep(DELAY)
return 1 return 1
...@@ -293,6 +294,7 @@ class TestStuff(greentest.TestCase): ...@@ -293,6 +294,7 @@ class TestStuff(greentest.TestCase):
# works. # works.
def raises_but_ignored(): def raises_but_ignored():
raise ExpectedError("count") raise ExpectedError("count")
def sleep_forever(): def sleep_forever():
while True: while True:
sleep(0.1) sleep(0.1)
......
...@@ -1000,7 +1000,6 @@ class ChunkedInputTests(TestCase): ...@@ -1000,7 +1000,6 @@ class ChunkedInputTests(TestCase):
self.assert_error(IOError, 'unexpected end of file while parsing chunked data') self.assert_error(IOError, 'unexpected end of file while parsing chunked data')
class Expect100ContinueTests(TestCase): class Expect100ContinueTests(TestCase):
validator = None validator = None
......
...@@ -25,6 +25,7 @@ are not leaked by the hub. ...@@ -25,6 +25,7 @@ are not leaked by the hub.
from __future__ import print_function from __future__ import print_function
from _socket import socket from _socket import socket
class Socket(socket): class Socket(socket):
"Something we can have a weakref to" "Something we can have a weakref to"
......
...@@ -33,6 +33,7 @@ class SimpleStreamServer(StreamServer): ...@@ -33,6 +33,7 @@ class SimpleStreamServer(StreamServer):
finally: finally:
fd.close() fd.close()
class Settings: class Settings:
ServerClass = StreamServer ServerClass = StreamServer
ServerSubClass = SimpleStreamServer ServerSubClass = SimpleStreamServer
......
...@@ -105,7 +105,7 @@ def compare_relaxed(a, b): ...@@ -105,7 +105,7 @@ def compare_relaxed(a, b):
a_segments = a.count(':') a_segments = a.count(':')
b_segments = b.count(':') b_segments = b.count(':')
if a_segments and b_segments: if a_segments and b_segments:
if a_segments == b_segments and a_segments in (4,5,6,7): if a_segments == b_segments and a_segments in (4, 5, 6, 7):
return True return True
if a.rstrip(':').startswith(b.rstrip(':')) or b.rstrip(':').startswith(a.rstrip(':')): if a.rstrip(':').startswith(b.rstrip(':')) or b.rstrip(':').startswith(a.rstrip(':')):
return True return True
...@@ -245,8 +245,7 @@ class TestCase(greentest.TestCase): ...@@ -245,8 +245,7 @@ class TestCase(greentest.TestCase):
# because it calls assertSequenceEqual, which highlights the exact # because it calls assertSequenceEqual, which highlights the exact
# difference in the tuple # difference in the tuple
msg = format_call(func, args) msg = format_call(func, args)
self.assertEqual((msg,gevent_result), (msg,real_result)) self.assertEqual((msg, gevent_result), (msg, real_result))
class TestTypeError(TestCase): class TestTypeError(TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment