-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
coords have a mix of types in the codebase. Some places:
Line 458 in 4ad7fa8
| coords=None, |
The conversion type:
Lines 911 to 914 in 4ad7fa8
| @property | |
| def coords(self) -> dict[str, tuple | None]: | |
| """Coordinate values for model dimensions.""" | |
| return self._coords |
Line 1065 in 4ad7fa8
| values: Sequence | np.ndarray, |
Line 126 in 4ad7fa8
| def coords_and_dims_for_inferencedata(model: Model) -> tuple[dict[str, Any], dict[str, Any]]: |
Seems to be a mix of Sequence and Sequence | np.ndarray so some
consolidation would be nice. For example, there is already a various amount of
typing for other objects like dims and shape:
pymc/pymc/distributions/shape_utils.py
Lines 88 to 98 in 4ad7fa8
| # User-provided can be lazily specified as scalars | |
| Shape: TypeAlias = int | TensorVariable | Sequence[int | Variable] | |
| Dims: TypeAlias = str | Sequence[str | None] | |
| DimsWithEllipsis: TypeAlias = str | EllipsisType | Sequence[str | None | EllipsisType] | |
| Size: TypeAlias = int | TensorVariable | Sequence[int | Variable] | |
| # After conversion to vectors | |
| StrongShape: TypeAlias = TensorVariable | tuple[int | Variable, ...] | |
| StrongDims: TypeAlias = Sequence[str] | |
| StrongDimsWithEllipsis: TypeAlias = Sequence[str | EllipsisType] | |
| StrongSize: TypeAlias = TensorVariable | tuple[int | Variable, ...] |
My main concern is not within pymc package directly but in the downstream
usage where using dict[str, Any] is probably the most common way to type
coords. So exposing would have some typing benefit.