Skip to content

Commit

Permalink
Fix mypy breakage due to watchdog 2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kiritofeng authored and Xyene committed Jan 2, 2023
1 parent baf1c7c commit f31a0a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dmoj/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
try:
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

has_watchdog_installed = True
except ImportError:
startup_warnings.append('watchdog module not found, install it to automatically update problems')
Observer = None
has_watchdog_installed = False

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -62,7 +64,7 @@ def on_any_event(self, event):

class Monitor:
def __init__(self):
if Observer is not None and not judgeenv.no_watchdog:
if has_watchdog_installed and not judgeenv.no_watchdog:
if judgeenv.env.update_pings:
logger.info('Using thread to ping urls: %r', judgeenv.env.update_pings)
self._refresher = RefreshWorker(judgeenv.env.update_pings)
Expand Down

0 comments on commit f31a0a7

Please sign in to comment.