Skip to content

Commit f669238

Browse files
authored
Merge pull request #591 from stan-dev/refactor-utilities
Split utils module into separate files
2 parents a03893a + e16320b commit f669238

19 files changed

+2302
-2142
lines changed

cmdstanpy/__init__.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@
66
import shutil
77
import tempfile
88

9-
_STANSUMMARY_STATS = [
10-
'Mean',
11-
'MCSE',
12-
'StdDev',
13-
'5%',
14-
'50%',
15-
'95%',
16-
'N_Eff',
17-
'N_Eff/s',
18-
'R_hat',
19-
]
20-
219
_TMPDIR = tempfile.mkdtemp()
2210
_CMDSTAN_WARMUP = 1000
2311
_CMDSTAN_SAMPLING = 1000
@@ -38,20 +26,20 @@ def _cleanup_tmpdir() -> None:
3826

3927
from ._version import __version__ # noqa
4028
from .install_cmdstan import rebuild_cmdstan
41-
from .model import CmdStanModel # noqa
42-
from .stanfit import ( # noqa
29+
from .model import CmdStanModel
30+
from .stanfit import (
4331
CmdStanGQ,
4432
CmdStanMCMC,
4533
CmdStanMLE,
4634
CmdStanVB,
4735
InferenceMetadata,
4836
from_csv,
4937
)
50-
from .utils import set_cmdstan_path # noqa
5138
from .utils import (
5239
cmdstan_path,
5340
cmdstan_version,
5441
install_cmdstan,
42+
set_cmdstan_path,
5543
set_make_env,
5644
show_versions,
5745
write_stan_json,

cmdstanpy/cmdstan_args.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ def validate(self) -> None:
830830
'0 and 2**32-1, found {}.'.format(self.seed)
831831
)
832832
if isinstance(self.seed, int):
833-
if self.seed < 0 or self.seed > 2**32 - 1:
833+
if self.seed < 0 or self.seed > 2 ** 32 - 1:
834834
raise ValueError(
835835
'Argument "seed" must be an integer between '
836836
'0 and 2**32-1, found {}.'.format(self.seed)
@@ -849,7 +849,7 @@ def validate(self) -> None:
849849
)
850850
)
851851
for seed in self.seed:
852-
if seed < 0 or seed > 2**32 - 1:
852+
if seed < 0 or seed > 2 ** 32 - 1:
853853
raise ValueError(
854854
'Argument "seed" must be an integer value'
855855
' between 0 and 2**32-1,'

cmdstanpy/install_cxx_toolchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from cmdstanpy.utils import pushd, validate_dir, wrap_url_progress_hook
2828

2929
EXTENSION = '.exe' if platform.system() == 'Windows' else ''
30-
IS_64BITS = sys.maxsize > 2**32
30+
IS_64BITS = sys.maxsize > 2 ** 32
3131

3232

3333
def usage() -> None:

cmdstanpy/stanfit/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
)
1313
from cmdstanpy.utils import check_sampler_csv, get_logger, scan_config
1414

15-
from .mcmc import CmdStanGQ, CmdStanMCMC
15+
from .gq import CmdStanGQ
16+
from .mcmc import CmdStanMCMC
1617
from .metadata import InferenceMetadata
1718
from .mle import CmdStanMLE
1819
from .runset import RunSet

0 commit comments

Comments
 (0)