Skip to content

Commit d88f3f9

Browse files
Upgrade to mypy v0.991 and fix mypy errors
1 parent 5aa1780 commit d88f3f9

File tree

4 files changed

+26
-25
lines changed

4 files changed

+26
-25
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ repos:
4747
)$
4848
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
4949
- repo: https://github.com/pre-commit/mirrors-mypy
50-
rev: v0.982
50+
rev: v0.991
5151
hooks:
5252
- id: mypy
5353
additional_dependencies:

aesara/link/c/cmodule.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,28 +2440,29 @@ def patch_ldflags(flag_list: List[str]) -> List[str]:
24402440
def linking_patch(lib_dirs: List[str], libs: List[str]) -> List[str]:
24412441
if sys.platform != "win32":
24422442
return [f"-l{l}" for l in libs]
2443-
2444-
def sort_key(lib): # type: ignore
2445-
name, *numbers, extension = lib.split(".")
2446-
return (extension == "dll", tuple(map(int, numbers)))
2447-
2448-
patched_lib_ldflags = []
2449-
for lib in libs:
2450-
ldflag = f"-l{lib}"
2451-
for lib_dir in lib_dirs:
2452-
lib_dir = lib_dir.strip('"')
2453-
windows_styled_libs = [
2454-
fname
2455-
for fname in os.listdir(lib_dir)
2456-
if not (os.path.isdir(os.path.join(lib_dir, fname)))
2457-
and fname.split(".")[0] == lib
2458-
and fname.split(".")[-1] in ["dll", "lib"]
2459-
]
2460-
if windows_styled_libs:
2461-
selected_lib = sorted(windows_styled_libs, key=sort_key)[-1]
2462-
ldflag = f'"{os.path.join(lib_dir, selected_lib)}"'
2463-
patched_lib_ldflags.append(ldflag)
2464-
return patched_lib_ldflags
2443+
else:
2444+
# In explicit else because of https://github.com/python/mypy/issues/10773
2445+
def sort_key(lib):
2446+
name, *numbers, extension = lib.split(".")
2447+
return (extension == "dll", tuple(map(int, numbers)))
2448+
2449+
patched_lib_ldflags = []
2450+
for lib in libs:
2451+
ldflag = f"-l{lib}"
2452+
for lib_dir in lib_dirs:
2453+
lib_dir = lib_dir.strip('"')
2454+
windows_styled_libs = [
2455+
fname
2456+
for fname in os.listdir(lib_dir)
2457+
if not (os.path.isdir(os.path.join(lib_dir, fname)))
2458+
and fname.split(".")[0] == lib
2459+
and fname.split(".")[-1] in ["dll", "lib"]
2460+
]
2461+
if windows_styled_libs:
2462+
selected_lib = sorted(windows_styled_libs, key=sort_key)[-1]
2463+
ldflag = f'"{os.path.join(lib_dir, selected_lib)}"'
2464+
patched_lib_ldflags.append(ldflag)
2465+
return patched_lib_ldflags
24652466

24662467
@staticmethod
24672468
def compile_str(

aesara/link/vm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def make_vm(
10561056
callback=self.callback,
10571057
callback_input=self.callback_input,
10581058
)
1059-
elif self.use_cloop and CVM:
1059+
elif self.use_cloop and CVM is not None:
10601060

10611061
# create a map from nodes to ints and vars to ints
10621062
nodes_idx = {}

aesara/scan/op.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3449,7 +3449,7 @@ def profile_printer(
34493449

34503450

34513451
@op_debug_information.register(Scan) # type: ignore[has-type]
3452-
def _op_debug_information_Scan(op, node):
3452+
def _op_debug_information_Scan(op: Scan, node: Apply):
34533453
from typing import Sequence
34543454

34553455
from aesara.scan.utils import ScanArgs

0 commit comments

Comments
 (0)