mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
clean the code
This commit is contained in:
parent
49c02c8c4c
commit
6deeeecc80
@ -3,11 +3,9 @@
|
||||
# This file is part of gunicorn released under the MIT license.
|
||||
# See the NOTICE for more information.
|
||||
|
||||
import ctypes
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import StringIO
|
||||
import sys
|
||||
from urllib import unquote
|
||||
|
||||
@ -15,7 +15,7 @@ import os
|
||||
import StringIO
|
||||
import tempfile
|
||||
|
||||
from gunicorn.util import MAX_BODY, CHUNK_SIZE, read_partial, fsize, fwrite
|
||||
from gunicorn.util import MAX_BODY, CHUNK_SIZE, read_partial
|
||||
|
||||
class TeeInput(object):
|
||||
|
||||
@ -154,7 +154,10 @@ class TeeInput(object):
|
||||
self._is_socket = False
|
||||
|
||||
def _tmp_size(self):
|
||||
return fsize(self.tmp)
|
||||
if isinstance(self.tmp, StringIO.StringIO):
|
||||
return self.tmp.len
|
||||
else:
|
||||
return int(os.fstat(self.tmp.fileno())[6])
|
||||
|
||||
def _ensure_length(self, buf, length):
|
||||
if not buf or not self._len:
|
||||
|
||||
@ -17,8 +17,7 @@ from django.core.handlers.wsgi import WSGIHandler
|
||||
|
||||
from gunicorn.arbiter import Arbiter
|
||||
from gunicorn.config import Config
|
||||
from gunicorn.main import daemonize, UMASK, configure_logging
|
||||
from gunicorn.util import parse_address, to_bytestring
|
||||
from gunicorn.main import daemonize, configure_logging
|
||||
|
||||
class Command(BaseCommand):
|
||||
option_list = BaseCommand.option_list + (
|
||||
|
||||
@ -5,13 +5,10 @@
|
||||
|
||||
import array
|
||||
import ctypes
|
||||
import errno
|
||||
import fcntl
|
||||
import os
|
||||
import resource
|
||||
import select
|
||||
import socket
|
||||
import StringIO
|
||||
import textwrap
|
||||
import time
|
||||
|
||||
@ -148,23 +145,6 @@ def write_error(sock, msg):
|
||||
%s
|
||||
""") % (len(html), html)
|
||||
write_nonblock(sock, http)
|
||||
|
||||
def fwrite(f, data):
|
||||
pos = f.tell()
|
||||
f.seek(fsize(f))
|
||||
f.write(data)
|
||||
f.flush()
|
||||
if hasattr(f, 'fileno'):
|
||||
os.fsync(f.fileno())
|
||||
f.seek(0, os.SEEK_END)
|
||||
f.seek(pos)
|
||||
|
||||
def fsize(f):
|
||||
if isinstance(f, StringIO.StringIO):
|
||||
return f.len
|
||||
else:
|
||||
return int(os.fstat(f.fileno())[6])
|
||||
|
||||
|
||||
def normalize_name(name):
|
||||
return "-".join([w.lower().capitalize() for w in name.split("-")])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user