Skip to content

Commit 5c6ecf7

Browse files
committed
Move type vars to typing module
1 parent 1f4cac3 commit 5c6ecf7

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/numcodecs_shuffle/__init__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44

55
__all__ = ["TypedByteShuffleCodec"]
66

7-
from typing import TypeVar
8-
97
import numcodecs.compat
108
import numcodecs.registry
119
import numpy as np
1210
from numcodecs.abc import Codec
1311

14-
T = TypeVar("T", bound=np.number, covariant=True)
15-
""" Any numpy [`number`][numpy.number] data type (covariant). """
16-
17-
S = TypeVar("S", bound=tuple[int, ...], covariant=True)
18-
""" Any array shape (covariant). """
12+
from .typing import S, T
1913

2014

2115
class TypedByteShuffleCodec(Codec):

src/numcodecs_shuffle/typing.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Commonly used type variables.
3+
"""
4+
5+
__all__ = ["S", "T"]
6+
7+
from typing import TypeVar
8+
9+
import numpy as np
10+
11+
S = TypeVar("S", bound=tuple[int, ...], covariant=True)
12+
""" Any array shape (covariant). """
13+
14+
T = TypeVar("T", bound=np.number, covariant=True)
15+
""" Any numpy [`number`][numpy.number] data type (covariant). """

0 commit comments

Comments
 (0)