提交 0a13fbd6 authored 作者: Ben Mares's avatar Ben Mares 提交者: Ricardo Vieira

Fix mypy problem on Windows due to platform differences

As reported in <https://github.com/pymc-devs/pytensor/pull/678#issuecomment-2036674730>, mypy was failing on Windows due to an unnecessary type: ignore. This fixes it by ignoring the unused-ignore so that Windows is covered.
上级 bc3dda0e
...@@ -284,7 +284,11 @@ def add_gcc_dll_directory() -> None: ...@@ -284,7 +284,11 @@ def add_gcc_dll_directory() -> None:
if (sys.platform == "win32") & (hasattr(os, "add_dll_directory")): if (sys.platform == "win32") & (hasattr(os, "add_dll_directory")):
gcc_path = shutil.which("gcc") gcc_path = shutil.which("gcc")
if gcc_path is not None: if gcc_path is not None:
os.add_dll_directory(os.path.dirname(gcc_path)) # type: ignore # Since add_dll_directory is only defined on windows, we need
# the ignore[attr-defined] on non-Windows platforms.
# For Windows we need ignore[unused-ignore] since the ignore
# is unnecessary with that platform.
os.add_dll_directory(os.path.dirname(gcc_path)) # type: ignore[attr-defined,unused-ignore]
def dlimport(fullpath, suffix=None): def dlimport(fullpath, suffix=None):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论