Skip to content

Commit

Permalink
Address typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed May 29, 2024
1 parent ce44460 commit d8995a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions py-polars/polars/datatypes/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,18 +757,18 @@ def __init__(
msg = "Array is missing the required argument `shape`."
raise TypeError(msg)

inner = polars.datatypes.py_type_to_dtype(inner)
inner_parsed = polars.datatypes.py_type_to_dtype(inner)

if isinstance(shape, int):
self.inner = inner
self.inner = inner_parsed
self.size = shape
self.shape = (shape,)

elif isinstance(shape, tuple):
if len(shape) > 1:
inner = Array(inner, shape[1:])
inner_parsed = Array(inner_parsed, shape[1:])

self.inner = inner
self.inner = inner_parsed
self.size = shape[0]
self.shape = shape

Expand Down
4 changes: 2 additions & 2 deletions py-polars/tests/unit/datatypes/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ def test_array_inner_recursive() -> None:
dtype = pl.Array(int, shape=shape)
for dim in shape:
assert dtype.size == dim
dtype = dtype.inner
dtype = dtype.inner # type: ignore[assignment]


def test_array_inner_recursive_python_dtype() -> None:
dtype = pl.Array(int, shape=(2, 3))
assert dtype.inner.inner == pl.Int64
assert dtype.inner.inner == pl.Int64 # type: ignore[union-attr]

0 comments on commit d8995a2

Please sign in to comment.