Skip to content

Commit

Permalink
Allow following imports on newer mypy daemon (msherry#56)
Browse files Browse the repository at this point in the history
* removed no-longer-necessary fail-on-import setting from dmypy

* Reworked to use old behavior on older mypy versions

* fixed version check for mypy daemon mode

* tightened up regexp for mypy/dmypy version detection
  • Loading branch information
efroemling committed Aug 28, 2020
1 parent 055830b commit e8ce874
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/pycheckers.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,9 @@ def runs_from_project_root(self): # type: ignore
r' (?P<level>[^:]+):'
r' (?P<description>.+)$')

# Note: this needs to match both mypy and dmypy
version_matcher = re.compile(
r'mypy (?P<version>[0-9.]+)'
r'd?mypy (?P<version>[0-9.]+)'
)

_base_flags = [
Expand Down Expand Up @@ -822,7 +823,11 @@ def get_run_flags(self, filepath):

if daemon_mode:
flags = [f for f in flags if f != '--incremental']
flags = ['run', '--timeout', '600', '--', '--follow-imports=error'] + flags
# Older daemon versions didn't support following imports
if self.version < LooseVersion('0.780'):
flags = ['run', '--timeout', '600', '--', '--follow-imports=error'] + flags
else:
flags = ['run', '--timeout', '600', '--'] + flags
else:
if self.version < LooseVersion('0.660'):
# --quick-and-dirty is still available
Expand Down

0 comments on commit e8ce874

Please sign in to comment.