Skip to content

Commit cdd0bfa

Browse files
committed
Tweak mypy
1 parent 832a42d commit cdd0bfa

5 files changed

Lines changed: 10 additions & 22 deletions

File tree

cmdstanpy/install_cmdstan.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828
from time import sleep
2929
from typing import Any, Callable, Dict, Optional
3030

31-
from tqdm.auto import tqdm # type: ignore
31+
from tqdm.auto import tqdm
3232

3333
from cmdstanpy import _DOT_CMDSTAN, _DOT_CMDSTANPY
34-
3534
from cmdstanpy.utils import (
3635
cmdstan_path,
3736
do_command,

cmdstanpy/install_cxx_toolchain.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,6 @@ def main(args: Dict[str, Any]) -> None:
303303

304304
if 'progress' in args:
305305
progress = args['progress']
306-
try:
307-
# pylint: disable=unused-import
308-
from tqdm import tqdm # noqa: F401
309-
except (ImportError, ModuleNotFoundError):
310-
progress = False
311306
else:
312307
progress = False
313308

cmdstanpy/model.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,17 @@
1414
from pathlib import Path
1515
from typing import Any, Callable, Dict, List, Mapping, Optional, Union
1616

17-
from tqdm.auto import tqdm # type: ignore
18-
19-
from cmdstanpy import (
20-
_CMDSTAN_REFRESH,
21-
_CMDSTAN_SAMPLING,
22-
_CMDSTAN_WARMUP,
23-
)
17+
from tqdm.auto import tqdm
2418

19+
from cmdstanpy import _CMDSTAN_REFRESH, _CMDSTAN_SAMPLING, _CMDSTAN_WARMUP
2520
from cmdstanpy.cmdstan_args import (
2621
CmdStanArgs,
2722
GenerateQuantitiesArgs,
2823
OptimizeArgs,
2924
SamplerArgs,
3025
VariationalArgs,
3126
)
32-
3327
from cmdstanpy.compiler_opts import CompilerOptions
34-
3528
from cmdstanpy.stanfit import (
3629
CmdStanGQ,
3730
CmdStanMCMC,
@@ -40,7 +33,6 @@
4033
RunSet,
4134
from_csv,
4235
)
43-
4436
from cmdstanpy.utils import (
4537
EXTENSION,
4638
MaybeDictToFilePath,
@@ -1353,10 +1345,10 @@ def _run_cmdstan(
13531345
) # make the typechecker happy
13541346
sampler_args.fixed_param = True
13551347

1356-
# pylint: disable=no-self-use
1348+
@staticmethod
13571349
@progbar.wrap_callback
13581350
def _wrap_sampler_progress_hook(
1359-
self, chain_id: int, total: int
1351+
chain_id: int, total: int
13601352
) -> Optional[Callable[[str], None]]:
13611353
"""Sets up tqdm callback for CmdStan sampler console msgs."""
13621354
pbar: tqdm = tqdm(

cmdstanpy/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import numpy as np
3232
import pandas as pd
3333
import ujson as json
34-
from tqdm.auto import tqdm # type: ignore
34+
from tqdm.auto import tqdm
3535

3636
from cmdstanpy import (
3737
_CMDSTAN_SAMPLING,
@@ -990,7 +990,7 @@ def do_command(
990990

991991

992992
def returncode_msg(retcode: int) -> str:
993-
""" interpret retcode"""
993+
"""interpret retcode"""
994994
if retcode < 0:
995995
sig = -1 * retcode
996996
return f'terminated by signal {sig}'

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ warn_return_any = true
2020

2121
[[tool.mypy.overrides]]
2222
module = [
23-
'tqdm',
23+
'tqdm.auto',
24+
25+
'tqdm.auto',
2426
'pandas',
2527
'ujson',
2628
'numpy', # these two are required for py36, which numpy 1.21 doesn't support

0 commit comments

Comments
 (0)