Ran into a problem with running this on windows. Im not entirely sure whats special about my setup that would cause this.
Relevant line from attached error message
line = "C:\\Users\\eehusky\\anaconda3\\lib\\site-packages\\_pytest\\_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
@classmethod
def from_output(cls, line: str) -> "Message":
m = cls.OUTPUT_RE.match(line)
if not m:
> raise ValueError("Not a valid mypy message")
E ValueError: Not a valid mypy message
Brass tacks, It think the entire absolute path getting included and is messing with the regex.
I think it is getting hung up on the C: in the file path in mypy messages. But I am by no means a regex guru so Ill withhold judgement.
OUTPUT_RE = re.compile(
r"^(?P<fname>[^:]+):" # << This
r"(?P<lineno>[0-9]+):"
r"((?P<colno>[0-9]+):)?"
r" *(?P<severity>(error|note|warning)):"
r"(?P<message>.*)$"
)
I did mess around with this a bit and found if i removed the C: from the text it would work fine.
import os
import re
OUTPUT_RE = re.compile(
r"^(?P<fname>[^:]+):"
r"(?P<lineno>[0-9]+):"
r"((?P<colno>[0-9]+):)?"
r" *(?P<severity>(error|note|warning)):"
r"(?P<message>.*)$"
)
def from_output(line: str) -> "Message":
m = OUTPUT_RE.match(line)
if not m:
raise ValueError("Not a valid mypy message")
return (
os.path.abspath(m.group("fname")),
int(m.group("lineno")),
int(m.group("colno")) if m.group("colno") else None,
m.group("severity").upper(),
m.group("message").strip(),
)
line = "C/Users/eehusky/anaconda3/lib/site-packages/_pytest/_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
print(from_output(line))
line = "C:/Users/eehusky/anaconda3/lib/site-packages/_pytest/_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
print(from_output(line))
Output from above test
('C:\\Users\\eehusky\\anaconda3\\lib\\site-packages\\_pytest\\_argcomplete.py', 103, 1, 'ERROR', "Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs")
----------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-f28f32de0f3a> in <module>
25 print(from_output(line))
26 line = "C:/Users/eehusky/anaconda3/lib/site-packages/_pytest/_argcomplete.py:103:1: error: Skipping analyzing 'argcomplete.completers': found module but no type hints or library stubs"
---> 27 print(from_output(line))
<ipython-input-17-f28f32de0f3a> in from_output(line)
12 m = OUTPUT_RE.match(line)
13 if not m:
---> 14 raise ValueError("Not a valid mypy message")
15 return (
16 os.path.abspath(m.group("fname")),
ValueError: Not a valid mypy message
Cheers,
-Brandon
output.txt
Ran into a problem with running this on windows. Im not entirely sure whats special about my setup that would cause this.
Relevant line from attached error message
Brass tacks, It think the entire absolute path getting included and is messing with the regex.
I think it is getting hung up on the C: in the file path in mypy messages. But I am by no means a regex guru so Ill withhold judgement.
I did mess around with this a bit and found if i removed the C: from the text it would work fine.
Output from above test
Cheers,
-Brandon
output.txt