Skip to content

Commit 8c2579e

Browse files
committed
Fixup docstrings
1 parent a43896f commit 8c2579e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cmdstanpy/utils/stancsv.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
def parse_comments_header_and_draws(
2020
stan_csv: Union[str, os.PathLike, Iterator[bytes]],
2121
) -> Tuple[List[bytes], Optional[str], List[bytes]]:
22-
"""Parses lines of a Stan CSV file into comment lines and draws lines, where
23-
a draws line is just a non-commented line.
22+
"""Parses lines of a Stan CSV file into comment lines, the header line,
23+
and draws lines.
2424
25-
Returns a (comment_lines, draws_lines) tuple.
25+
Returns a (comment_lines, header, draws_lines) tuple.
2626
"""
2727

2828
def partition_csv(
@@ -226,8 +226,8 @@ def parse_variational_eta(comment_lines: List[bytes]) -> float:
226226
def extract_max_treedepth_and_divergence_counts(
227227
header: str, draws_lines: List[bytes], max_treedepth: int, warmup_draws: int
228228
) -> Tuple[int, int]:
229-
"""Extracts the max treedepth and divergence counts from the draw lines
230-
of the MCMC stan csv output."""
229+
"""Extracts the max treedepth and divergence counts from the header
230+
and draw lines of the MCMC stan csv output."""
231231
if len(draws_lines) <= 1: # Empty draws
232232
return 0, 0
233233
column_names = header.split(",")
@@ -346,6 +346,10 @@ def column_count(ln: bytes) -> int:
346346

347347

348348
def raise_on_invalid_adaptation_block(comment_lines: List[bytes]) -> None:
349+
"""Throws ValueErrors if the parsed adaptation block is invalid, e.g.
350+
the metric information is not present, consistent with the rest of
351+
the file, or the step size info cannot be processed."""
352+
349353
def column_count(ln: bytes) -> int:
350354
return ln.count(b",") + 1
351355

0 commit comments

Comments
 (0)