Skip to content

Commit

Permalink
[1.0] Remove deprecations
Browse files Browse the repository at this point in the history
Merge pull request #460 from stan-dev/remove-deprecations
  • Loading branch information
WardBrian authored Oct 18, 2021
2 parents c83b739 + 78a8e9d commit 63b46d4
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 464 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ disable=bad-continuation,
consider-using-with,
consider-using-dict-items,
unspecified-encoding,
consider-using-f-string
consider-using-f-string,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
1 change: 0 additions & 1 deletion cmdstanpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
_CMDSTAN_SAMPLING = 1000
_CMDSTAN_THIN = 1
_CMDSTAN_REFRESH = 100
_DOT_CMDSTANPY = '.cmdstanpy'
_DOT_CMDSTAN = '.cmdstan'


Expand Down
7 changes: 0 additions & 7 deletions cmdstanpy/cmdstan_args.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
CmdStan arguments
"""
import logging
import os
from enum import Enum, auto
from time import time
Expand Down Expand Up @@ -721,7 +720,6 @@ def __init__(
save_latent_dynamics: bool = False,
save_profile: bool = False,
refresh: Optional[int] = None,
logger: Optional[logging.Logger] = None,
) -> None:
"""Initialize object."""
self.model_name = model_name
Expand All @@ -745,11 +743,6 @@ def __init__(
elif isinstance(method_args, VariationalArgs):
self.method = Method.VARIATIONAL
self.method_args.validate(len(chain_ids) if chain_ids else None)
if logger is not None:
get_logger().warning(
"Parameter 'logger' is deprecated."
" Control logging behavior via logging.getLogger('cmdstanpy')"
)
self.validate()

def validate(self) -> None:
Expand Down
7 changes: 0 additions & 7 deletions cmdstanpy/compiler_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Makefile options for stanc and C++ compilers
"""

import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
Expand Down Expand Up @@ -57,17 +56,11 @@ def __init__(
stanc_options: Optional[Dict[str, Any]] = None,
cpp_options: Optional[Dict[str, Any]] = None,
user_header: Optional[str] = None,
logger: Optional[logging.Logger] = None,
) -> None:
"""Initialize object."""
self._stanc_options = stanc_options if stanc_options is not None else {}
self._cpp_options = cpp_options if cpp_options is not None else {}
self._user_header = user_header if user_header is not None else ''
if logger is not None:
get_logger().warning(
"Parameter 'logger' is deprecated."
" Control logging behavior via logging.getLogger('cmdstanpy')"
)

def __repr__(self) -> str:
return 'stanc_options={}, cpp_options={}'.format(
Expand Down
12 changes: 1 addition & 11 deletions cmdstanpy/install_cmdstan.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@

from tqdm.auto import tqdm

from cmdstanpy import _DOT_CMDSTAN, _DOT_CMDSTANPY
from cmdstanpy import _DOT_CMDSTAN
from cmdstanpy.utils import (
cmdstan_path,
do_command,
get_logger,
pushd,
validate_dir,
wrap_url_progress_hook,
Expand Down Expand Up @@ -465,15 +464,6 @@ def main(args: Dict[str, Any]) -> None:
)

cmdstan_dir = os.path.expanduser(os.path.join('~', _DOT_CMDSTAN))
if not os.path.exists(cmdstan_dir):
cmdstanpy_dir = os.path.expanduser(os.path.join('~', _DOT_CMDSTANPY))
if os.path.exists(cmdstanpy_dir):
cmdstan_dir = cmdstanpy_dir
get_logger().warning(
"Using ~/.cmdstanpy is deprecated and"
" will not be automatically detected in version 1.0!\n"
" Please rename to ~/.cmdstan"
)

install_dir = cmdstan_dir
if args['dir']:
Expand Down
17 changes: 2 additions & 15 deletions cmdstanpy/install_cxx_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
from time import sleep
from typing import Any, Dict, List

from cmdstanpy import _DOT_CMDSTAN, _DOT_CMDSTANPY
from cmdstanpy import _DOT_CMDSTAN
from cmdstanpy.utils import (
get_logger,
pushd,
validate_dir,
wrap_url_progress_hook,
Expand Down Expand Up @@ -285,19 +284,7 @@ def main(args: Dict[str, Any]) -> None:

install_dir = args['dir']
if install_dir is None:
cmdstan_dir = os.path.expanduser(os.path.join('~', _DOT_CMDSTAN))
if not os.path.exists(cmdstan_dir):
cmdstanpy_dir = os.path.expanduser(
os.path.join('~', _DOT_CMDSTANPY)
)
if os.path.exists(cmdstanpy_dir):
cmdstan_dir = cmdstanpy_dir
get_logger().warning(
"Using ~/.cmdstanpy is deprecated and"
" will not be automatically detected in version 1.0!\n"
" Please rename to ~/.cmdstan"
)
install_dir = cmdstan_dir
install_dir = os.path.expanduser(os.path.join('~', _DOT_CMDSTAN))
validate_dir(install_dir)
print('Install directory: {}'.format(install_dir))

Expand Down
7 changes: 0 additions & 7 deletions cmdstanpy/model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""CmdStanModel"""

import io
import logging
import os
import platform
import re
Expand Down Expand Up @@ -91,7 +90,6 @@ def __init__(
stanc_options: Optional[Dict[str, Any]] = None,
cpp_options: Optional[Dict[str, Any]] = None,
user_header: Optional[str] = None,
logger: Optional[logging.Logger] = None,
) -> None:
"""
Initialize object given constructor args.
Expand All @@ -113,11 +111,6 @@ def __init__(
cpp_options=cpp_options,
user_header=user_header,
)
if logger is not None:
get_logger().warning(
"Parameter 'logger' is deprecated."
" Control logging behavior via logging.getLogger('cmdstanpy')"
)

if model_name is not None:
if not model_name.strip():
Expand Down
Loading

0 comments on commit 63b46d4

Please sign in to comment.