diff --git a/flake8/_pyflakes.py b/flake8/_pyflakes.py index daf2749..fabcfbd 100644 --- a/flake8/_pyflakes.py +++ b/flake8/_pyflakes.py @@ -1,4 +1,10 @@ # -*- coding: utf-8 -*- +try: + # The 'demandimport' breaks pyflakes and flake8._pyflakes + from mercurial import demandimport + demandimport.disable() +except ImportError: + pass import pyflakes import pyflakes.checker diff --git a/flake8/hooks.py b/flake8/hooks.py index 5173883..a84c312 100644 --- a/flake8/hooks.py +++ b/flake8/hooks.py @@ -6,12 +6,6 @@ import stat from subprocess import Popen, PIPE import shutil from tempfile import mkdtemp -try: - # The 'demandimport' breaks pyflakes and flake8._pyflakes - from mercurial import demandimport - demandimport.disable() -except ImportError: - pass try: from configparser import ConfigParser except ImportError: # Python 2