From 5b2f98fca4e2d85448fcbf711288af6c33225a2e Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 22 Apr 2010 19:41:29 +0200 Subject: [PATCH] fix erros spotted by pyflakes --- README.rst | 2 +- doc/site/usage.rst | 2 +- gunicorn/arbiter.py | 1 - gunicorn/debug.py | 1 - gunicorn/http/response.py | 2 +- gunicorn/main.py | 8 ++++---- gunicorn/management/commands/run_gunicorn.py | 7 +++---- gunicorn/workers/async.py | 2 -- gunicorn/workers/geventlet.py | 15 +++------------ gunicorn/workers/ggevent.py | 9 ++------- 10 files changed, 15 insertions(+), 34 deletions(-) diff --git a/README.rst b/README.rst index 3059ad4d..e40b0e82 100644 --- a/README.rst +++ b/README.rst @@ -52,7 +52,7 @@ Usage unix:/tmp/gunicorn.sock -k WORKERCLASS, --worker-class=WORKERCLASS The type of request processing to use - [egg:gunicorn#main] + [egg:gunicorn#sync] -w WORKERS, --workers=WORKERS Number of workers to spawn. [1] -p PIDFILE, --pid=PIDFILE diff --git a/doc/site/usage.rst b/doc/site/usage.rst index b0e0b3aa..872985e6 100644 --- a/doc/site/usage.rst +++ b/doc/site/usage.rst @@ -45,7 +45,7 @@ Full command line usage unix:/tmp/gunicorn.sock -k WORKERCLASS, --worker-class=WORKERCLASS The type of request processing to use - [egg:gunicorn#main] + [egg:gunicorn#sync] -w WORKERS, --workers=WORKERS Number of workers to spawn. [1] -p PIDFILE, --pid=PIDFILE diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index cb4a5ad1..96f379b5 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -12,7 +12,6 @@ import os import select import signal import sys -import tempfile import time import traceback diff --git a/gunicorn/debug.py b/gunicorn/debug.py index 0d923d28..ebd9aaec 100644 --- a/gunicorn/debug.py +++ b/gunicorn/debug.py @@ -6,7 +6,6 @@ """The debug module contains utilities and functions for better debugging Gunicorn.""" -import os import sys import linecache import re diff --git a/gunicorn/http/response.py b/gunicorn/http/response.py index 95b3c9b7..3de05fe3 100644 --- a/gunicorn/http/response.py +++ b/gunicorn/http/response.py @@ -3,7 +3,7 @@ # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. -from gunicorn.util import close, http_date, write, write_chunk, is_hoppish +from gunicorn.util import http_date, write, write_chunk, is_hoppish class Response(object): diff --git a/gunicorn/main.py b/gunicorn/main.py index c2186dd4..ebf0ab6f 100644 --- a/gunicorn/main.py +++ b/gunicorn/main.py @@ -35,7 +35,7 @@ def options(): help='Number of workers to spawn. [1]'), op.make_option('-k', '--worker-class', dest='workerclass', help="The type of request processing to use "+ - "[egg:gunicorn#main]"), + "[egg:gunicorn#sync]"), op.make_option('-p','--pid', dest='pidfile', help='set the background PID FILE'), op.make_option('-D', '--daemon', dest='daemon', action="store_true", @@ -163,10 +163,10 @@ def run_paster(): relpath = os.path.dirname(cfgfname) # load module in sys path - sys.path.insert(0, relative_to) + sys.path.insert(0, relpath) # add to eggs - pkg_resources.working_set.add_entry(relative_to) + pkg_resources.working_set.add_entry(relpath) ctx = loadwsgi.loadcontext(loadwsgi.SERVER, cfgurl, relative_to=relpath) if not opts.workers: @@ -196,7 +196,7 @@ def run_paster(): opts.default_proc_name= ctx.global_conf.get('__file__') - app = loadapp(config_url, relative_to=relative_to) + app = loadapp(cfgurl, relative_to=relpath) return app main("%prog [OPTIONS] pasteconfig.ini", get_app) diff --git a/gunicorn/management/commands/run_gunicorn.py b/gunicorn/management/commands/run_gunicorn.py index 9ad4995f..e574300c 100644 --- a/gunicorn/management/commands/run_gunicorn.py +++ b/gunicorn/management/commands/run_gunicorn.py @@ -15,7 +15,6 @@ from django.utils import translation from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException from django.core.handlers.wsgi import WSGIHandler -from gunicorn.arbiter import Arbiter from gunicorn.config import Config from gunicorn.main import daemonize, configure_logging @@ -25,11 +24,11 @@ class Command(BaseCommand): help='Specifies the directory from which to serve admin media.'), make_option('-c', '--config', dest='gconfig', type='string', help='Gunicorn Config file. [%default]'), + make_option('-k', '--worker-class', dest='workerclass', + help="The type of request processing to use "+ + "[egg:gunicorn#sync]"), make_option('-w', '--workers', dest='workers', help='Specifies the number of worker processes to use.'), - make_option('-a', '--arbiter', dest='arbiter', - help="gunicorn arbiter entry point or module "+ - "[egg:gunicorn#main]"), make_option('--pid', dest='pidfile', help='set the background PID file'), make_option( '--daemon', dest='daemon', action="store_true", diff --git a/gunicorn/workers/async.py b/gunicorn/workers/async.py index 7222972f..76a53cb7 100644 --- a/gunicorn/workers/async.py +++ b/gunicorn/workers/async.py @@ -4,8 +4,6 @@ # See the NOTICE for more information. import errno -import os -import select import socket import traceback diff --git a/gunicorn/workers/geventlet.py b/gunicorn/workers/geventlet.py index 5959ae0e..d29e1821 100644 --- a/gunicorn/workers/geventlet.py +++ b/gunicorn/workers/geventlet.py @@ -5,24 +5,15 @@ from __future__ import with_statement -import collections -import errno -import traceback - import eventlet import eventlet.debug from eventlet.green import os -from eventlet.green import socket -from eventlet import greenio from eventlet import greenlet from eventlet import greenpool from eventlet import greenthread -from gunicorn import util -from gunicorn import arbiter -from gunicorn.workers.async import AsyncWorker, ALREADY_HANDLED -from gunicorn.http.tee import UnexpectedEOF +from gunicorn.workers.async import AsyncWorker eventlet.debug.hub_exceptions(True) @@ -57,11 +48,11 @@ class EventletWorker(AsyncWorker): eventlet.sleep(0.1) - with evenlet.Timeout(self.timeout, False): + with eventlet.Timeout(self.timeout, False): pool.waitall() def acceptor(self, pool): - server_gt = greenthread.getcurrent() + greenthread.getcurrent() while True: try: conn, addr = self.socket.accept() diff --git a/gunicorn/workers/ggevent.py b/gunicorn/workers/ggevent.py index e3ee1c81..ffde163a 100644 --- a/gunicorn/workers/ggevent.py +++ b/gunicorn/workers/ggevent.py @@ -5,20 +5,15 @@ from __future__ import with_statement -import errno import os import gevent from gevent import monkey monkey.noisy = False -from gevent import socket from gevent import greenlet from gevent.pool import Pool -from gunicorn import util -from gunicorn import arbiter -from gunicorn.workers.async import AsyncWorker, ALREADY_HANDLED -from gunicorn.http.tee import UnexpectedEOF +from gunicorn.workers.async import AsyncWorker class GEventWorker(AsyncWorker): @@ -54,7 +49,7 @@ class GEventWorker(AsyncWorker): pass def acceptor(self, pool): - server_gt = gevent.getcurrent() + gevent.getcurrent() while self.alive: try: conn, addr = self.socket.accept()