MyPy 由于底层模块中的语法错误而崩溃

问题描述

我正在尝试在我的包上运行 MyPy,但由于底层包中的语法错误而遇到问题,这不是我维护的。

我正在使用以下 mypy 文件运行 mypy.ini

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

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

我得到的回溯如下

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)

所以基本上我已经确保任何构建目录或以点开头的目录(尤其是 .venv)都不会作为直接来源包含在内。它仍然崩溃,因为它可能在其他地方使用了确实包括 .venv 包和模块作为源的代码。我不确定如何忽略这些错误并让 MyPy 正常运行。虽然稍后我可以通过包含特定于模块的配置来忽略一些错误,但它不会让我忽略语法错误

MyPy 的问题在于模块文件中某些函数函数定义中包含的 # type: <type>

对如何解决这个问题有任何想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)