Skip to content

Commit e1c4301

Browse files
committed
lint
1 parent 817de5f commit e1c4301

3 files changed

Lines changed: 32 additions & 25 deletions

File tree

scripts/activateMatlab.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
def _registry_search(release: str) -> Path | None:
3030
try:
3131
# must use "\" as path separator in Windows registry
32-
matlab_path = winreg.QueryValue(
33-
winreg.HKEY_LOCAL_MACHINE, rf"SOFTWARE\MathWorks\{release}\MATLAB"
32+
matlab_path = winreg.QueryValue( # type: ignore[attr-defined]
33+
winreg.HKEY_LOCAL_MACHINE, # type: ignore[attr-defined]
34+
rf"SOFTWARE\MathWorks\{release}\MATLAB",
3435
)
3536

3637
return Path(matlab_path)

scripts/get_matlab_version_xml.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ def get_matlab_version(root: Path) -> str:
2828
raise FileNotFoundError(xmlPath)
2929

3030
tree = ET.parse(xmlPath)
31-
root = tree.getroot()
31+
xroot = tree.getroot()
3232

33-
return root.find('version').text
33+
v = xroot.find("version")
34+
35+
return v.text.strip() if v is not None and v.text is not None else "Unknown version"
3436

3537

3638
if __name__ == "__main__":
37-
parser = argparse.ArgumentParser(description="Get MATLAB version from VersionInfo.xml")
38-
parser.add_argument('matlab_root', nargs='?', help="Path to MATLAB root directory")
39+
parser = argparse.ArgumentParser(
40+
description="Get MATLAB version from VersionInfo.xml"
41+
)
42+
parser.add_argument("matlab_root", nargs="?", help="Path to MATLAB root directory")
3943
args = parser.parse_args()
4044

4145
root = Path(args.matlab_root) if args.matlab_root else get_matlab_root()

scripts/test_matlab_versions.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55

66
# these are HPC system specific
77
version_keys = [
8-
"2025b",
9-
"2025a",
10-
"2024b",
11-
"2024a",
12-
"2023b",
13-
"2023a",
14-
"2022b",
15-
"2022a",
16-
"2021b",
17-
"2021a",
18-
"2020b",
19-
"2020a",
20-
"2019b",
21-
"2019a",
22-
"2018b",
23-
"2018a",
24-
"2017b",
25-
"2017a",
8+
"2025b",
9+
"2025a",
10+
"2024b",
11+
"2024a",
12+
"2023b",
13+
"2023a",
14+
"2022b",
15+
"2022a",
16+
"2021b",
17+
"2021a",
18+
"2020b",
19+
"2020a",
20+
"2019b",
21+
"2019a",
22+
"2018b",
23+
"2018a",
24+
"2017b",
25+
"2017a",
2626
]
2727

2828
R = Path(__file__).parents[1]
@@ -32,7 +32,9 @@
3232
@pytest.mark.parametrize("version", version_keys)
3333
def test_matlab_version(version):
3434

35-
ret = subprocess.run(f"module is-avail matlab/{version}", shell=True, capture_output=True, text=True)
35+
ret = subprocess.run(
36+
f"module is-avail matlab/{version}", shell=True, capture_output=True, text=True
37+
)
3638
if ret.returncode != 0:
3739
pytest.skip(f"MATLAB version {version} not available {ret.stderr}")
3840

0 commit comments

Comments
 (0)