Skip to content

MyPy 1.7.0 typing errors #7230

@f-schnabel

Description

@f-schnabel

Describe the bug
When running runtests.sh --mypy there are some errors and deprecations that are issued.
The reason is probably the newly released mypy 1.7.0.

Warning: --strict-concatenate is deprecated; use --extra-checks instead
monai\transforms\io\array.py:272:28: error: Value of type Never is not indexable  [index]
monai\metrics\utils.py:396:22: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "List[Any]")  [assignment]
monai\apps\deepgrow\interaction.py:85:37: error: "Sequence[Callable[..., Any]]" not callable  [operator]
monai\apps\auto3dseg\data_analyzer.py:15:1: error: Module "multiprocessing.context" has no attribute "ForkServerContext"  [attr-defined]
Found 5 errors in 5 files (checked 1109 source files)

To Reproduce
Run runtests.sh --mypy

Expected behavior
No errors/issues found.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment`

================================
Printing MONAI config...
================================
MONAI version: 1.3.0+25.gfec7cf17
Numpy version: 1.24.4
Pytorch version: 2.1.0+cpu
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: fec7cf176740efcd3edb6ced6f18bbbc3b775852
MONAI __file__: E:\Programming\open-source\MONAI\monai\__init__.py

Optional dependencies:
Pytorch Ignite version: 0.4.11
ITK version: 5.3.0
Nibabel version: 5.1.0
scikit-image version: 0.21.0
scipy version: 1.10.1
Pillow version: 10.0.1
Tensorboard version: 2.14.0
gdown version: 4.7.1
TorchVision version: 0.16.0+cpu
tqdm version: 4.66.1
lmdb version: 1.4.1
psutil version: 5.9.6
pandas version: 2.0.3
einops version: 0.7.0
transformers version: 4.21.3
mlflow version: 2.8.0
pynrrd version: 1.0.0
clearml version: 1.13.2

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies


================================
Printing system config...
================================
System: Windows
Win32 version: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free')
Win32 edition: Core
Platform: Windows-10-10.0.19041-SP0
Processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
Machine: AMD64
Python version: 3.8.6
Process name: python.exe
Command: ['C:\\Users\\fschn\\AppData\\Local\\Programs\\Python\\Python38\\python.exe', '-c', 'import monai; monai.config.print_debug_info()']
Open files: [popenfile(path='C:\\Windows\\System32\\en-US\\kernel32.dll.mui', fd=-1), popenfile(path='C:\\Program Files\\WindowsApps\\Microsoft.LanguageExperiencePacken-GB_19041.52.174.0_neutral__8wekyb
3d8bbwe\\Windows\\System32\\en-GB\\tzres.dll.mui', fd=-1), popenfile(path='C:\\Windows\\System32\\en-US\\KernelBase.dll.mui', fd=-1)]
Num physical CPUs: 4
Num logical CPUs: 8
Num usable CPUs: 8
CPU usage (%): [36.5, 11.6, 17.4, 8.1, 16.8, 18.6, 22.2, 30.3]
CPU freq. (MHz): 4001
Load avg. in last 1, 5, 15 mins (%): [0.0, 0.0, 0.0]
Disk usage (%): 7.2
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 31.9
Available memory (GB): 17.4
Used memory (GB): 14.5

================================
Printing GPU config...
================================
Num GPUs: 0
Has CUDA: False
cuDNN enabled: False
NVIDIA_TF32_OVERRIDE: None
TORCH_ALLOW_TF32_CUBLAS_OVERRIDE: None

Additional context
I would like to contribute the fixes myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions