Skip to content

Commit 799f296

Browse files
committed
Type cleanup
1 parent 5bf764e commit 799f296

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stanio/reshape.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Variable:
4747
# list of nested parameters
4848
contents: List["Variable"]
4949

50-
def dtype(self, top=True):
50+
def dtype(self, top: bool = True) -> np.dtype:
5151
if self.type == VariableType.TUPLE:
5252
elts = [
5353
(str(i + 1), param.dtype(top=False))
@@ -75,7 +75,7 @@ def elt_size(self) -> int:
7575

7676
# total size is elt_size * num_elts
7777

78-
def _extract_helper(self, src: np.ndarray, offset: int = 0):
78+
def _extract_helper(self, src: np.ndarray, offset: int = 0) -> np.ndarray:
7979
start = self.start_idx + offset
8080
end = self.end_idx + offset
8181
if self.type == VariableType.SCALAR:
@@ -98,7 +98,7 @@ def _extract_helper(self, src: np.ndarray, offset: int = 0):
9898
out[i, idx] = tuple(elt[i] for elt in elts)
9999
return out.reshape(-1, *self.dimensions, order="F")
100100

101-
def extract_reshape(self, src: np.ndarray, object=True) -> npt.NDArray[Any]:
101+
def extract_reshape(self, src: np.ndarray, object: bool = True) -> npt.NDArray[Any]:
102102
"""
103103
Given an array where the final dimension is the flattened output of a
104104
Stan model, (e.g. one row of a Stan CSV file), extract the variable

0 commit comments

Comments
 (0)