scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
440 stars 82 forks source link

Broken type hint #553

Closed michalk8 closed 2 years ago

michalk8 commented 2 years ago

Description

Can't import squidpy on 3.8, introduced by #551 , problem is type[...] instead of Type[...].

Minimal reproducible example

import squidpy  # on Python3.8

Traceback

```pytb Traceback (most recent call last): File "", line 1, in File "/opt/projects/helmholtz/squidpy/squidpy/__init__.py", line 1, in from squidpy import gr, im, pl, read, datasets File "/opt/projects/helmholtz/squidpy/squidpy/gr/__init__.py", line 2, in from squidpy.gr._build import spatial_neighbors File "/opt/projects/helmholtz/squidpy/squidpy/gr/_build.py", line 26, in from squidpy._docs import d, inject_docs File "/opt/projects/helmholtz/squidpy/squidpy/_docs.py", line 7, in from squidpy._constants._pkg_constants import Key File "/opt/projects/helmholtz/squidpy/squidpy/_constants/_pkg_constants.py", line 8, in from squidpy._constants._constants import Processing, SegmentationBackend File "/opt/projects/helmholtz/squidpy/squidpy/_constants/_constants.py", line 4, in from squidpy._constants._utils import ModeEnum File "/opt/projects/helmholtz/squidpy/squidpy/_constants/_utils.py", line 7, in def _pretty_raise_enum(cls: type["ModeEnum"], fun: Callable[..., Any]) -> Callable[..., Any]: TypeError: 'type' object is not subscriptable ```

Version

https://github.com/scverse/squidpy/commit/9dd5f16e306136cd274e11f4def3a995486aa00d

giovp commented 2 years ago

my bad, updated pyupgrade to 3.9 instead of keeping 3.8