From 7eadeb941716f8430f92fc0ee14597cdd66cfe13 Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Mon, 12 Aug 2024 17:12:29 +0200 Subject: [PATCH] lint: split availability testing from usage --- gunicorn/reloader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gunicorn/reloader.py b/gunicorn/reloader.py index 1c67f2a7d..6cdc5438a 100644 --- a/gunicorn/reloader.py +++ b/gunicorn/reloader.py @@ -56,14 +56,15 @@ def run(self): has_inotify = False if sys.platform.startswith('linux'): try: - from inotify.adapters import Inotify - import inotify.constants + import inotify.constants as _ has_inotify = True except ImportError: pass if has_inotify: + from inotify.adapters import Inotify + import inotify.constants class InotifyReloader(threading.Thread): event_mask = (inotify.constants.IN_CREATE | inotify.constants.IN_DELETE