提交 d88f3f9e authored 作者: Michael Osthege's avatar Michael Osthege

Upgrade to mypy v0.991 and fix mypy errors

上级 5aa17801
......@@ -47,7 +47,7 @@ repos:
)$
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
rev: v0.991
hooks:
- id: mypy
additional_dependencies:
......
......@@ -2440,28 +2440,29 @@ class GCC_compiler(Compiler):
def linking_patch(lib_dirs: List[str], libs: List[str]) -> List[str]:
if sys.platform != "win32":
return [f"-l{l}" for l in libs]
def sort_key(lib): # type: ignore
name, *numbers, extension = lib.split(".")
return (extension == "dll", tuple(map(int, numbers)))
patched_lib_ldflags = []
for lib in libs:
ldflag = f"-l{lib}"
for lib_dir in lib_dirs:
lib_dir = lib_dir.strip('"')
windows_styled_libs = [
fname
for fname in os.listdir(lib_dir)
if not (os.path.isdir(os.path.join(lib_dir, fname)))
and fname.split(".")[0] == lib
and fname.split(".")[-1] in ["dll", "lib"]
]
if windows_styled_libs:
selected_lib = sorted(windows_styled_libs, key=sort_key)[-1]
ldflag = f'"{os.path.join(lib_dir, selected_lib)}"'
patched_lib_ldflags.append(ldflag)
return patched_lib_ldflags
else:
# In explicit else because of https://github.com/python/mypy/issues/10773
def sort_key(lib):
name, *numbers, extension = lib.split(".")
return (extension == "dll", tuple(map(int, numbers)))
patched_lib_ldflags = []
for lib in libs:
ldflag = f"-l{lib}"
for lib_dir in lib_dirs:
lib_dir = lib_dir.strip('"')
windows_styled_libs = [
fname
for fname in os.listdir(lib_dir)
if not (os.path.isdir(os.path.join(lib_dir, fname)))
and fname.split(".")[0] == lib
and fname.split(".")[-1] in ["dll", "lib"]
]
if windows_styled_libs:
selected_lib = sorted(windows_styled_libs, key=sort_key)[-1]
ldflag = f'"{os.path.join(lib_dir, selected_lib)}"'
patched_lib_ldflags.append(ldflag)
return patched_lib_ldflags
@staticmethod
def compile_str(
......
......@@ -1056,7 +1056,7 @@ class VMLinker(LocalLinker):
callback=self.callback,
callback_input=self.callback_input,
)
elif self.use_cloop and CVM:
elif self.use_cloop and CVM is not None:
# create a map from nodes to ints and vars to ints
nodes_idx = {}
......
......@@ -3449,7 +3449,7 @@ def profile_printer(
@op_debug_information.register(Scan) # type: ignore[has-type]
def _op_debug_information_Scan(op, node):
def _op_debug_information_Scan(op: Scan, node: Apply):
from typing import Sequence
from aesara.scan.utils import ScanArgs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论