It seems that the re.compile types are to restrictive, the following code errors in mypy but running it is no problem:
# _txt_fmt is a object gotten from `re.compile`withopen(file, 'r+') asf:
withmmap.mmap(f.fileno(), 0) asdata:
match=_txt_fmt.match(data)
Mypy gives the error Argument 1 to "match" of "Pattern" has incompatible type "mmap"; expected "bytes".
It seems that the
re.compiletypes are to restrictive, the following code errors in mypy but running it is no problem:Mypy gives the error
Argument 1 to "match" of "Pattern" has incompatible type "mmap"; expected "bytes".