From 56e7d15fb87e75f849636da4038744a93906d898 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Mon, 24 Nov 2014 18:43:21 +0200 Subject: [PATCH] Use more Pythonic style in gunicorn/. --- gunicorn/glogging.py | 2 +- gunicorn/util.py | 2 +- gunicorn/workers/gaiohttp.py | 2 +- gunicorn/workers/gthread.py | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 03e7692b..47b002f6 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -314,7 +314,7 @@ class Logger(object): def _get_gunicorn_handler(self, log): for h in log.handlers: - if getattr(h, "_gunicorn", False) == True: + if getattr(h, "_gunicorn", False): return h def _set_handler(self, log, output, fmt): diff --git a/gunicorn/util.py b/gunicorn/util.py index 22a3f4e8..3f79fcbb 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -406,7 +406,7 @@ def daemonize(enable_stdio_inheritance=False): Standard daemonization of a process. http://www.svbug.com/documentation/comp.unix.programmer-FAQ/faq_2.html#SEC16 """ - if not 'GUNICORN_FD' in os.environ: + if 'GUNICORN_FD' not in os.environ: if os.fork(): os._exit(0) os.setsid() diff --git a/gunicorn/workers/gaiohttp.py b/gunicorn/workers/gaiohttp.py index 8260bb50..899e9a37 100644 --- a/gunicorn/workers/gaiohttp.py +++ b/gunicorn/workers/gaiohttp.py @@ -7,7 +7,7 @@ import sys if sys.version_info >= (3, 3): try: - import aiohttp + import aiohttp # NOQA except ImportError: raise RuntimeError("You need aiohttp installed to use this worker.") else: diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index f36d92c4..a8050b15 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -15,7 +15,6 @@ from datetime import datetime import errno from functools import partial import os -import operator import socket import ssl import sys