MyPy crashes due to syntax error in underlying modules

Viewed 302

I'm trying to run MyPy on my package, but I'm running into issues due to a syntax error in an underlying package, that is not maintained by me.

I'm running mypy with the following mypy.ini file

[mypy]
files = **/*.py
ignore_missing_imports = True
pretty = True
show_error_codes = True
exclude = /(build|\..*)/$

[mypy-azure.storage.filedatalake.*]
ignore_errors = True

And the traceback that I'm getting is the following

LOG:  Parsing ~\.venv\lib\site-packages\azure\storage\filedatalake\_data_lake_file_client.py (azure.storage.filedatalake._data_lake_file_client)
LOG:  Bailing due to parse errors
LOG:  Build finished in 0.553 seconds with 4 modules, and 1 errors
~\.venv\lib\site-packages\azure\storage\filedatalake\_data_lake_file_client.py:280: error: Function has duplicate type signatures  [syntax]
        def set_file_expiry(
        ^
Found 1 error in 1 file (errors prevented further checking)

So basically I've made sure that any build directory or a directory starting with a dot (especially .venv) is not included as a direct source. Still it crashes, because it probably is used elsewhere in code that does include .venv packages and modules as sources. I'm not sure how to ignore these errors and let MyPy run normally. Whilst I can ignore some errors later on by including a module specific configuration, it won't let me ignore syntax errors.

What MyPy is having issues with is the # type: <type> that is included in the function definition of some of the functions in the module file.

Any thoughts on how to fix this?

0 Answers
Related