Skip to content

Commit 6d8d67d

Browse files
STYLE: Enforce import of __future__ annotations (#106)
Once __future__ annotations become available the `|` notation can be used in python 3.9. So ruff was here allowed to standardize type annotations based on that. This will help reduce confusion about linter complaints in the future.
1 parent 9549f4b commit 6d8d67d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+265
-122
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# -- Project information -----------------------------------------------------
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
from __future__ import annotations
89

910
import importlib.metadata
1011

notebooks/LIFUTestWidget.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import logging
35
import sys

notebooks/run_self_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from openlifu.io.LIFUInterface import LIFUInterface
24

35
# set PYTHONPATH=%cd%\src;%PYTHONPATH%

notebooks/stress_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import random
24

35
from openlifu.io.LIFUInterface import LIFUInterface

notebooks/test_first.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# Also, if you are using the original version, import `openlifu` takes _way_ longer (45s on my PC), presumably hanging on `import kwave`. For some reason, it wants to re-download the binaries every time, even though they are already present in the the installation directory. I've opened an issue on this: https://github.com/waltsims/k-wave-python/issues/366.
2222

2323
# %%
24+
from __future__ import annotations
25+
2426
import logging
2527
import sys
2628

notebooks/test_nifti.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# ---
1515

1616
# %%
17+
from __future__ import annotations
18+
1719
modified_kwave_path = R'C:\Users\pjh7\git\k-wave-python'
1820
slicer_exe = R"C:\Users\pjh7\AppData\Local\NA-MIC\Slicer 5.2.2\Slicer.exe"
1921
import sys

notebooks/test_nucleo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from openlifu.io.LIFUInterface import LIFUInterface
24

35
# set PYTHONPATH=%cd%\src;%PYTHONPATH%

notebooks/test_registers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# ---
1515

1616
# %%
17+
from __future__ import annotations
18+
1719
import numpy as np
1820

1921
from openlifu.io.LIFUTXDevice import (

notebooks/test_solution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# language: python
1212
# name: python3
1313
# ---
14+
from __future__ import annotations
1415

1516
# +
1617
import numpy as np

notebooks/test_ti_cfg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from openlifu.io.LIFUInterface import LIFUInterface
24

35
# set PYTHONPATH=%cd%\src;%PYTHONPATH%

0 commit comments

Comments
 (0)