From 49e57d36bbf30c26a1e85a4cc8e8688291da94d8 Mon Sep 17 00:00:00 2001 From: benoitc Date: Wed, 17 Mar 2010 01:06:17 +0100 Subject: [PATCH] remove useless examples --- examples/eventlet_longpoll.py | 29 -------------------- examples/gevent_websocket.py | 3 +- examples/{gevent_longpoll.py => longpoll.py} | 3 +- examples/{eventlet_test.py => slowclient.py} | 8 ++---- examples/test.py | 5 ++++ examples/test_keepalive.py | 17 ------------ examples/websocket.py | 2 +- gunicorn/async/gevent_server.py | 2 -- 8 files changed, 12 insertions(+), 57 deletions(-) delete mode 100644 examples/eventlet_longpoll.py rename examples/{gevent_longpoll.py => longpoll.py} (90%) rename examples/{eventlet_test.py => slowclient.py} (74%) delete mode 100644 examples/test_keepalive.py diff --git a/examples/eventlet_longpoll.py b/examples/eventlet_longpoll.py deleted file mode 100644 index 97ba6b61..00000000 --- a/examples/eventlet_longpoll.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 - -# -# This file is part of grainbows released under the MIT license. -# See the NOTICE for more information. - -import eventlet -import time -eventlet.monkey_patch(all=False, os=True, select=True, socket=True) - -class TestIter(object): - - def __iter__(self): - lines = ['line 1\n', 'line 2\n'] - for line in lines: - yield line - time.sleep(10) - -def app(environ, start_response): - """Application which cooperatively pauses 10 seconds before responding""" - data = 'Hello, World!\n' - status = '200 OK' - response_headers = [ - ('Content-type','text/plain'), - ('Transfer-Encoding', "chunked"), - ] - print 'request received' - start_response(status, response_headers) - return TestIter() - \ No newline at end of file diff --git a/examples/gevent_websocket.py b/examples/gevent_websocket.py index a5ecda0d..652c71b9 100644 --- a/examples/gevent_websocket.py +++ b/examples/gevent_websocket.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 - # -# This file is part of grainbow released under the MIT license. +# This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # # Example code from Eventlet sources @@ -8,7 +8,6 @@ import collections import errno from grainbows.worker_base import ALREADY_HANDLED -from eventlet import pools import socket import gevent from gevent.pool import Pool diff --git a/examples/gevent_longpoll.py b/examples/longpoll.py similarity index 90% rename from examples/gevent_longpoll.py rename to examples/longpoll.py index d308aa5c..094550d1 100644 --- a/examples/gevent_longpoll.py +++ b/examples/longpoll.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 - # -# This file is part of grainbows released under the MIT license. +# This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import time + class TestIter(object): def __iter__(self): diff --git a/examples/eventlet_test.py b/examples/slowclient.py similarity index 74% rename from examples/eventlet_test.py rename to examples/slowclient.py index f2d3ce11..d4304a76 100644 --- a/examples/eventlet_test.py +++ b/examples/slowclient.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 - # -# This file is part of grainbows released under the MIT license. +# This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from wsgiref.validate import validator -import eventlet - -eventlet.monkey_patch(all=False, os=False, select=True, socket=True) +import time @validator @@ -19,6 +17,6 @@ def app(environ, start_response): ('Content-type','text/plain'), ('Content-Length', str(len(data))) ] print 'request received, pausing 10 seconds' - eventlet.sleep(10) + time.sleep(10) start_response(status, response_headers) return iter([data]) \ No newline at end of file diff --git a/examples/test.py b/examples/test.py index d0723f76..f824b740 100644 --- a/examples/test.py +++ b/examples/test.py @@ -1,4 +1,9 @@ # -*- coding: utf-8 - +# +# This file is part of gunicorn released under the MIT license. +# See the NOTICE for more information. +# +# Example code from Eventlet sources from wsgiref.validate import validator diff --git a/examples/test_keepalive.py b/examples/test_keepalive.py deleted file mode 100644 index 8a4f99ad..00000000 --- a/examples/test_keepalive.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 - -# -# This file is part of grainbows released under the MIT license. -# See the NOTICE for more information. - -from wsgiref.validate import validator - - -def app(environ, start_response): - """Application which cooperatively pauses 10 seconds before responding""" - data = 'Hello, World!\n' - status = '200 OK' - response_headers = [ - ('Content-type','text/plain'), - ('Content-Length', str(len(data))) ] - start_response(status, response_headers) - return iter([data]) \ No newline at end of file diff --git a/examples/websocket.py b/examples/websocket.py index 81d65453..91279bce 100644 --- a/examples/websocket.py +++ b/examples/websocket.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 - # -# This file is part of grainbow released under the MIT license. +# This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # # Example code from Eventlet sources diff --git a/gunicorn/async/gevent_server.py b/gunicorn/async/gevent_server.py index 41bc7377..448ebed0 100644 --- a/gunicorn/async/gevent_server.py +++ b/gunicorn/async/gevent_server.py @@ -9,7 +9,6 @@ import os import gevent from gevent import socket -from gevent.event import Event from gevent.greenlet import Greenlet from gevent.pool import Pool @@ -23,7 +22,6 @@ class GEventWorker(KeepaliveWorker): def init_process(self): super(GEventWorker, self).init_process() self.pool = Pool(self.worker_connections) - #self.socket = socket.socket(_sock=self.socket) def accept(self): try: