Skip to content

Commit 1635915

Browse files
committed
Remove stringified type hints
This necessitates using `from __future__ import annotations` but will eventually become default behavior.
1 parent 82a85d2 commit 1635915

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

cmdstanpy/stanfit/gq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,18 +423,18 @@ def draws_xr(
423423

424424
@overload
425425
def draws_xr(
426-
self: "CmdStanGQ[CmdStanMCMC]",
426+
self: CmdStanGQ[CmdStanMCMC],
427427
vars: str | list[str] | None = None,
428428
inc_warmup: bool = False,
429429
inc_sample: bool = False,
430-
) -> "xr.Dataset": ...
430+
) -> xr.Dataset: ...
431431

432432
def draws_xr(
433433
self,
434434
vars: str | list[str] | None = None,
435435
inc_warmup: bool = False,
436436
inc_sample: bool = False,
437-
) -> "xr.Dataset":
437+
) -> xr.Dataset:
438438
"""
439439
Returns the generated quantities draws as a xarray Dataset.
440440

cmdstanpy/stanfit/laplace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Container for the result of running a laplace approximation.
33
"""
44

5+
from __future__ import annotations
6+
57
from typing import Any, Hashable, MutableMapping
68

79
import numpy as np
@@ -197,7 +199,7 @@ def draws_pd(
197199
def draws_xr(
198200
self,
199201
vars: str | list[str] | None = None,
200-
) -> "xr.Dataset":
202+
) -> xr.Dataset:
201203
"""
202204
Returns the sampler draws as a xarray Dataset.
203205

cmdstanpy/stanfit/mcmc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Container for the result of running the sample (MCMC) method
33
"""
44

5+
from __future__ import annotations
6+
57
import math
68
import os
79
from io import StringIO
@@ -678,7 +680,7 @@ def draws_pd(
678680

679681
def draws_xr(
680682
self, vars: str | list[str] | None = None, inc_warmup: bool = False
681-
) -> "xr.Dataset":
683+
) -> xr.Dataset:
682684
"""
683685
Returns the sampler draws as a xarray Dataset.
684686

cmdstanpy/stanfit/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(
3939
@classmethod
4040
def from_csv(
4141
cls, stan_csv: str | os.PathLike | Iterator[bytes]
42-
) -> 'InferenceMetadata':
42+
) -> InferenceMetadata:
4343
try:
4444
comments, header, _ = stancsv.parse_comments_header_and_draws(
4545
stan_csv

cmdstanpy/utils/logging.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
CmdStanPy logging
33
"""
44

5+
from __future__ import annotations
6+
57
import functools
68
import logging
79
import types
@@ -39,7 +41,7 @@ def __init__(self, disable: bool) -> None:
3941
def __repr__(self) -> str:
4042
return ""
4143

42-
def __enter__(self) -> "ToggleLogging":
44+
def __enter__(self) -> ToggleLogging:
4345
self.logger.disabled = self.disable
4446
return self
4547

0 commit comments

Comments
 (0)