mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Implement proper editor integration for mypy
This commit is contained in:
14
mypy-editor-integration
Executable file
14
mypy-editor-integration
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
files = [x for x in sys.argv[1:] if not x.startswith('-')]
|
||||
if not files:
|
||||
raise SystemExit(subprocess.Popen(['mypy'] + sys.argv[1:]).wait())
|
||||
|
||||
output = subprocess.run('dmypy run -- --follow-imports=error --show-column-numbers --no-color-output'.split(), stdout=subprocess.PIPE).stdout
|
||||
q = files[0] + ':'
|
||||
for line in output.decode('utf-8').splitlines():
|
||||
if line.startswith(q):
|
||||
print(line)
|
||||
Reference in New Issue
Block a user