Fixing errors reported by pycodestyle

This commit is contained in:
samypr100 2023-01-22 21:20:11 -05:00
parent 48eda22a4b
commit 2ea4699fe7
No known key found for this signature in database
GPG Key ID: E1717AA77760955D
11 changed files with 86 additions and 84 deletions

View File

@ -154,7 +154,7 @@ class Arbiter(object):
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.info("Listening at: %s (%s)", listeners_str, self.pid)
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))
else:
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'])
@ -454,11 +454,11 @@ class Arbiter(object):
# do we need to change listener ?
if old_address != self.cfg.address:
# close all listeners
for l in self.LISTENERS:
l.close()
for lnr in self.LISTENERS:
lnr.close()
# init new listeners
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)
# do some actions on reload

View File

@ -563,6 +563,7 @@ class ConfigFile(Setting):
prefix.
"""
class WSGIApp(Setting):
name = "wsgi_app"
section = "Config File"
@ -575,6 +576,7 @@ class WSGIApp(Setting):
.. versionadded:: 20.1.0
"""
class Bind(Setting):
name = "bind"
action = "append"
@ -1277,8 +1279,9 @@ class ForwardedAllowIPS(Setting):
.. note::
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
have a request from the remote address 134.213.44.18, and the default value of ``secure_scheme_headers``:
``secure_scheme_headers`` is complex. Various scenarios are documented below to further elaborate.
In each case, we have a request from the remote address 134.213.44.18, and the default value of
``secure_scheme_headers``:
.. code::
@ -1617,6 +1620,7 @@ class StatsdHost(Setting):
.. versionadded:: 19.1
"""
# Datadog Statsd (dogstatsd) tags. https://docs.datadoghq.com/developers/dogstatsd/
class DogstatsdTags(Setting):
name = "dogstatsd_tags"
@ -1632,6 +1636,7 @@ class DogstatsdTags(Setting):
.. versionadded:: 20
"""
class StatsdPrefix(Setting):
name = "statsd_prefix"
section = "Logging"

View File

@ -44,7 +44,6 @@ SYSLOG_FACILITIES = {
"local7": 23
}
CONFIG_DEFAULTS = dict(
version=1,
disable_existing_loggers=False,
@ -299,7 +298,7 @@ class Logger(object):
'a': environ.get('HTTP_USER_AGENT', '-'),
'T': request_time.seconds,
'D': (request_time.seconds * 1000000) + request_time.microseconds,
'M': (request_time.seconds * 1000) + int(request_time.microseconds/1000),
'M': (request_time.seconds * 1000) + int(request_time.microseconds / 1000),
'L': "%d.%06d" % (request_time.seconds, request_time.microseconds),
'p': "<%s>" % os.getpid()
}

View File

@ -58,7 +58,6 @@ def sd_notify(state, logger, unset_environment=False):
child processes.
"""
addr = os.environ.get('NOTIFY_SOCKET')
if addr is None:
# not run in a service, just a noop
@ -69,7 +68,7 @@ def sd_notify(state, logger, unset_environment=False):
addr = '\0' + addr[1:]
sock.connect(addr)
sock.sendall(state.encode('utf-8'))
except:
except Exception:
logger.debug("Exception while invoking sd_notify()", exc_info=True)
finally:
if unset_environment:

View File

@ -97,7 +97,7 @@ def load_class(uri, default="gunicorn.workers.sync.SyncWorker",
try:
mod = importlib.import_module('.'.join(components))
except:
except Exception:
exc = traceback.format_exc()
msg = "class uri %r invalid or not found: \n\n[%s]"
raise RuntimeError(msg % (uri, exc))

View File

@ -66,7 +66,6 @@ def _eventlet_socket_sendfile(self, file, offset=0, count=None):
file.seek(offset + total_sent)
def _eventlet_serve(sock, handle, concurrency):
"""
Serve requests forever.