Skip to content

Commit c50a397

Browse files
committed
Import typing.SupportsIndex to avoid forward reference error.
1 parent 5cc2323 commit c50a397

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ ignore_missing_imports = True
144144
ignore_missing_imports = True
145145
[mypy-sgkit.*]
146146
allow_redefinition = True
147+
[mypy-sgkit.io.bgen.*]
148+
# avoid warning on unused ignore for Python 3.8, but not unused for 3.7
149+
warn_unused_ignores = False
147150
[mypy-sgkit.*.tests.*]
148151
disallow_untyped_defs = False
149152
disallow_untyped_decorators = False

sgkit/io/bgen/bgen_reader.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
from sgkit.io.utils import dataframe_to_dict, encode_contigs
3232
from sgkit.typing import ArrayLike, PathType
3333

34+
try:
35+
# needed to avoid Sphinx forward reference error for DTypeLike
36+
# try block is needed since SupportsIndex is in Python 3.7
37+
from typing import SupportsIndex # type: ignore # noqa: F401
38+
except ImportError: # pragma: no cover
39+
pass
40+
3441
logger = logging.getLogger(__name__)
3542

3643
GT_DATA_VARS = [

0 commit comments

Comments
 (0)