mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Remove dead code found using vulture (#1469)
https://pypi.python.org/pypi/vulture In particular the removal of `get_maxfd()` means the `resource` module is no longer required (which is not available on Windows) and so helps with #524.
This commit is contained in:
parent
3cca730144
commit
fbd151e984
@ -470,22 +470,6 @@ def validate_chdir(val):
|
||||
return path
|
||||
|
||||
|
||||
def validate_file(val):
|
||||
if val is None:
|
||||
return None
|
||||
|
||||
# valid if the value is a string
|
||||
val = validate_string(val)
|
||||
|
||||
# transform relative paths
|
||||
path = os.path.abspath(os.path.normpath(os.path.join(util.getcwd(), val)))
|
||||
|
||||
# test if the path exists
|
||||
if not os.path.exists(path):
|
||||
raise ConfigError("%r not found" % val)
|
||||
|
||||
return path
|
||||
|
||||
def validate_hostport(val):
|
||||
val = validate_string(val)
|
||||
if val is None:
|
||||
|
||||
@ -29,7 +29,6 @@ except ImportError:
|
||||
# with sending files in blocks over 2GB.
|
||||
BLKSIZE = 0x3FFFFFFF
|
||||
|
||||
NORMALIZE_SPACE = re.compile(r'(?:\r\n)?[ \t]+')
|
||||
HEADER_VALUE_RE = re.compile(r'[\x00-\x1F\x7F]')
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -13,7 +13,6 @@ from gunicorn.glogging import Logger
|
||||
from gunicorn import six
|
||||
|
||||
# Instrumentation constants
|
||||
STATSD_DEFAULT_PORT = 8125
|
||||
METRIC_VAR = "metric"
|
||||
VALUE_VAR = "value"
|
||||
MTYPE_VAR = "mtype"
|
||||
|
||||
@ -12,7 +12,6 @@ import os
|
||||
import pkg_resources
|
||||
import pwd
|
||||
import random
|
||||
import resource
|
||||
import socket
|
||||
import sys
|
||||
import textwrap
|
||||
@ -28,15 +27,8 @@ from gunicorn.errors import AppImportError
|
||||
from gunicorn.six import text_type
|
||||
from gunicorn.workers import SUPPORTED_WORKERS
|
||||
|
||||
MAXFD = 1024
|
||||
REDIRECT_TO = getattr(os, 'devnull', '/dev/null')
|
||||
|
||||
timeout_default = object()
|
||||
|
||||
CHUNK_SIZE = (16 * 1024)
|
||||
|
||||
MAX_BODY = 1024 * 132
|
||||
|
||||
# Server and Date aren't technically hop-by-hop
|
||||
# headers, but they are in the purview of the
|
||||
# origin server which the WSGI spec says we should
|
||||
@ -271,13 +263,6 @@ def parse_address(netloc, default_port=8000):
|
||||
return (host, port)
|
||||
|
||||
|
||||
def get_maxfd():
|
||||
maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
|
||||
if (maxfd == resource.RLIM_INFINITY):
|
||||
maxfd = MAXFD
|
||||
return maxfd
|
||||
|
||||
|
||||
def close_on_exec(fd):
|
||||
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
|
||||
flags |= fcntl.FD_CLOEXEC
|
||||
@ -333,11 +318,6 @@ def write_nonblock(sock, data, chunked=False):
|
||||
return write(sock, data, chunked)
|
||||
|
||||
|
||||
def writelines(sock, lines, chunked=False):
|
||||
for line in list(lines):
|
||||
write(sock, line, chunked)
|
||||
|
||||
|
||||
def write_error(sock, status_int, reason, mesg):
|
||||
html = textwrap.dedent("""\
|
||||
<html>
|
||||
@ -361,10 +341,6 @@ def write_error(sock, status_int, reason, mesg):
|
||||
write_nonblock(sock, http.encode('latin1'))
|
||||
|
||||
|
||||
def normalize_name(name):
|
||||
return "-".join([w.lower().capitalize() for w in name.split("-")])
|
||||
|
||||
|
||||
def import_app(module):
|
||||
parts = module.split(":", 1)
|
||||
if len(parts) == 1:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user