mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Fixing errors reported by pycodestyle
This commit is contained in:
parent
48eda22a4b
commit
2ea4699fe7
@ -154,7 +154,7 @@ class Arbiter(object):
|
|||||||
|
|
||||||
self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)
|
self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)
|
||||||
|
|
||||||
listeners_str = ",".join([str(l) for l in self.LISTENERS])
|
listeners_str = ",".join([str(lnr) for lnr in self.LISTENERS])
|
||||||
self.log.debug("Arbiter booted")
|
self.log.debug("Arbiter booted")
|
||||||
self.log.info("Listening at: %s (%s)", listeners_str, self.pid)
|
self.log.info("Listening at: %s (%s)", listeners_str, self.pid)
|
||||||
self.log.info("Using worker: %s", self.cfg.worker_class_str)
|
self.log.info("Using worker: %s", self.cfg.worker_class_str)
|
||||||
@ -421,7 +421,7 @@ class Arbiter(object):
|
|||||||
environ['LISTEN_FDS'] = str(len(self.LISTENERS))
|
environ['LISTEN_FDS'] = str(len(self.LISTENERS))
|
||||||
else:
|
else:
|
||||||
environ['GUNICORN_FD'] = ','.join(
|
environ['GUNICORN_FD'] = ','.join(
|
||||||
str(l.fileno()) for l in self.LISTENERS)
|
str(lnr.fileno()) for lnr in self.LISTENERS)
|
||||||
|
|
||||||
os.chdir(self.START_CTX['cwd'])
|
os.chdir(self.START_CTX['cwd'])
|
||||||
|
|
||||||
@ -454,11 +454,11 @@ class Arbiter(object):
|
|||||||
# do we need to change listener ?
|
# do we need to change listener ?
|
||||||
if old_address != self.cfg.address:
|
if old_address != self.cfg.address:
|
||||||
# close all listeners
|
# close all listeners
|
||||||
for l in self.LISTENERS:
|
for lnr in self.LISTENERS:
|
||||||
l.close()
|
lnr.close()
|
||||||
# init new listeners
|
# init new listeners
|
||||||
self.LISTENERS = sock.create_sockets(self.cfg, self.log)
|
self.LISTENERS = sock.create_sockets(self.cfg, self.log)
|
||||||
listeners_str = ",".join([str(l) for l in self.LISTENERS])
|
listeners_str = ",".join([str(lnr) for lnr in self.LISTENERS])
|
||||||
self.log.info("Listening at: %s", listeners_str)
|
self.log.info("Listening at: %s", listeners_str)
|
||||||
|
|
||||||
# do some actions on reload
|
# do some actions on reload
|
||||||
|
|||||||
@ -563,6 +563,7 @@ class ConfigFile(Setting):
|
|||||||
prefix.
|
prefix.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class WSGIApp(Setting):
|
class WSGIApp(Setting):
|
||||||
name = "wsgi_app"
|
name = "wsgi_app"
|
||||||
section = "Config File"
|
section = "Config File"
|
||||||
@ -575,6 +576,7 @@ class WSGIApp(Setting):
|
|||||||
.. versionadded:: 20.1.0
|
.. versionadded:: 20.1.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Bind(Setting):
|
class Bind(Setting):
|
||||||
name = "bind"
|
name = "bind"
|
||||||
action = "append"
|
action = "append"
|
||||||
@ -1277,8 +1279,9 @@ class ForwardedAllowIPS(Setting):
|
|||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The interplay between the request headers, the value of ``forwarded_allow_ips``, and the value of
|
The interplay between the request headers, the value of ``forwarded_allow_ips``, and the value of
|
||||||
``secure_scheme_headers`` is complex. Various scenarios are documented below to further elaborate. In each case, we
|
``secure_scheme_headers`` is complex. Various scenarios are documented below to further elaborate.
|
||||||
have a request from the remote address 134.213.44.18, and the default value of ``secure_scheme_headers``:
|
In each case, we have a request from the remote address 134.213.44.18, and the default value of
|
||||||
|
``secure_scheme_headers``:
|
||||||
|
|
||||||
.. code::
|
.. code::
|
||||||
|
|
||||||
@ -1617,6 +1620,7 @@ class StatsdHost(Setting):
|
|||||||
.. versionadded:: 19.1
|
.. versionadded:: 19.1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Datadog Statsd (dogstatsd) tags. https://docs.datadoghq.com/developers/dogstatsd/
|
# Datadog Statsd (dogstatsd) tags. https://docs.datadoghq.com/developers/dogstatsd/
|
||||||
class DogstatsdTags(Setting):
|
class DogstatsdTags(Setting):
|
||||||
name = "dogstatsd_tags"
|
name = "dogstatsd_tags"
|
||||||
@ -1632,6 +1636,7 @@ class DogstatsdTags(Setting):
|
|||||||
.. versionadded:: 20
|
.. versionadded:: 20
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class StatsdPrefix(Setting):
|
class StatsdPrefix(Setting):
|
||||||
name = "statsd_prefix"
|
name = "statsd_prefix"
|
||||||
section = "Logging"
|
section = "Logging"
|
||||||
|
|||||||
@ -44,7 +44,6 @@ SYSLOG_FACILITIES = {
|
|||||||
"local7": 23
|
"local7": 23
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CONFIG_DEFAULTS = dict(
|
CONFIG_DEFAULTS = dict(
|
||||||
version=1,
|
version=1,
|
||||||
disable_existing_loggers=False,
|
disable_existing_loggers=False,
|
||||||
|
|||||||
@ -58,7 +58,6 @@ def sd_notify(state, logger, unset_environment=False):
|
|||||||
child processes.
|
child processes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
addr = os.environ.get('NOTIFY_SOCKET')
|
addr = os.environ.get('NOTIFY_SOCKET')
|
||||||
if addr is None:
|
if addr is None:
|
||||||
# not run in a service, just a noop
|
# not run in a service, just a noop
|
||||||
@ -69,7 +68,7 @@ def sd_notify(state, logger, unset_environment=False):
|
|||||||
addr = '\0' + addr[1:]
|
addr = '\0' + addr[1:]
|
||||||
sock.connect(addr)
|
sock.connect(addr)
|
||||||
sock.sendall(state.encode('utf-8'))
|
sock.sendall(state.encode('utf-8'))
|
||||||
except:
|
except Exception:
|
||||||
logger.debug("Exception while invoking sd_notify()", exc_info=True)
|
logger.debug("Exception while invoking sd_notify()", exc_info=True)
|
||||||
finally:
|
finally:
|
||||||
if unset_environment:
|
if unset_environment:
|
||||||
|
|||||||
@ -97,7 +97,7 @@ def load_class(uri, default="gunicorn.workers.sync.SyncWorker",
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
mod = importlib.import_module('.'.join(components))
|
mod = importlib.import_module('.'.join(components))
|
||||||
except:
|
except Exception:
|
||||||
exc = traceback.format_exc()
|
exc = traceback.format_exc()
|
||||||
msg = "class uri %r invalid or not found: \n\n[%s]"
|
msg = "class uri %r invalid or not found: \n\n[%s]"
|
||||||
raise RuntimeError(msg % (uri, exc))
|
raise RuntimeError(msg % (uri, exc))
|
||||||
|
|||||||
@ -66,7 +66,6 @@ def _eventlet_socket_sendfile(self, file, offset=0, count=None):
|
|||||||
file.seek(offset + total_sent)
|
file.seek(offset + total_sent)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _eventlet_serve(sock, handle, concurrency):
|
def _eventlet_serve(sock, handle, concurrency):
|
||||||
"""
|
"""
|
||||||
Serve requests forever.
|
Serve requests forever.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user