From f47e01fbcc456bcc5832dc8ba2fd98be8f06b183 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 15 Jul 2024 17:29:24 -0500 Subject: [PATCH 1/2] Convert .pylintrc file to pyproject.toml (#797) Removes a dotfile from the root directory. --------- Co-authored-by: Sergiy Matusevych --- .pylintrc | 52 --------------------------------------------- Makefile | 2 +- pyproject.toml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 57 insertions(+), 54 deletions(-) delete mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index c6c512ecb7..0000000000 --- a/.pylintrc +++ /dev/null @@ -1,52 +0,0 @@ -# vim: set ft=dosini: - -[MAIN] -# Specify a score threshold to be exceeded before program exits with error. -fail-under=9.9 - -# Make sure public methods are documented. -# See Also: https://github.com/PyCQA/pydocstyle/issues/309#issuecomment-1426642147 -# Also fail on unused imports. -fail-on= - missing-function-docstring, - unused-import - -# Ignore pylint complaints about an upstream dependency. -ignored-modules=ConfigSpace.hyperparameters - -# Help inform pylint where to find the project's source code without needing to relyon PYTHONPATH. -#init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc())); from logging import warning; warning(sys.path)" -init-hook="from logging import warning; warning(sys.path)" - -# Load some extra checkers. -load-plugins= - pylint.extensions.bad_builtin, - pylint.extensions.code_style, - pylint.extensions.docparams, - pylint.extensions.docstyle, - pylint.extensions.for_any_all, - pylint.extensions.mccabe, - pylint.extensions.no_self_use, - pylint.extensions.private_import, - pylint.extensions.redefined_loop_name, - pylint.extensions.redefined_variable_type, - pylint.extensions.set_membership, - pylint.extensions.typing - -[FORMAT] -# Maximum number of characters on a single line. -max-line-length=99 - -[MESSAGE CONTROL] -disable= - fixme, - no-else-return, - consider-using-assignment-expr, - deprecated-typing-alias, # disable for now - only deprecated recently - docstring-first-line-empty, - consider-alternative-union-syntax, # disable for now - still supporting python 3.8 - missing-raises-doc - -[STRING] -check-quote-consistency=yes -check-str-concat-over-line-jumps=yes diff --git a/Makefile b/Makefile index 145b641607..297ba39303 100644 --- a/Makefile +++ b/Makefile @@ -343,7 +343,7 @@ build/pylint.mlos_viz.${CONDA_ENV_NAME}.build-stamp: $(MLOS_VIZ_PYTHON_FILES) PYLINT_COMMON_PREREQS := build/conda-env.${CONDA_ENV_NAME}.build-stamp PYLINT_COMMON_PREREQS += $(FORMAT_PREREQS) -PYLINT_COMMON_PREREQS += .pylintrc +PYLINT_COMMON_PREREQS += pyproject.toml build/pylint.%.${CONDA_ENV_NAME}.build-stamp: $(PYLINT_COMMON_PREREQS) conda run -n ${CONDA_ENV_NAME} pylint -j0 $(filter %.py,$+) diff --git a/pyproject.toml b/pyproject.toml index f70030a576..4380245f79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ profile = "black" py_version = 311 src_paths = ["mlos_core", "mlos_bench", "mlos_viz"] +# TODO: Consider switching to pydocstringformatter [tool.docformatter] recursive = true black = true @@ -15,4 +16,58 @@ style = "numpy" pre-summary-newline = true close-quotes-on-newline = true -# TODO: move pylintrc and some setup.cfg configs here +# TODO: move some other setup.cfg configs here + +[tool.pylint.main] +# Specify a score threshold to be exceeded before program exits with error. +fail-under = 9.9 + +# Make sure public methods are documented. +# See Also: https://github.com/PyCQA/pydocstyle/issues/309#issuecomment-1426642147 +# Also fail on unused imports. +fail-on = [ + "missing-function-docstring", + "unused-import", +] + +# Ignore pylint complaints about an upstream dependency. +ignored-modules = ["ConfigSpace.hyperparameters"] + +# Help inform pylint where to find the project's source code without needing to relyon PYTHONPATH. +#init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc())); from logging import warning; warning(sys.path)" +init-hook = "from logging import warning; warning(sys.path)" + +# Load some extra checkers. +load-plugins = [ + "pylint.extensions.bad_builtin", + "pylint.extensions.code_style", + "pylint.extensions.docparams", + "pylint.extensions.docstyle", + "pylint.extensions.for_any_all", + "pylint.extensions.mccabe", + "pylint.extensions.no_self_use", + "pylint.extensions.private_import", + "pylint.extensions.redefined_loop_name", + "pylint.extensions.redefined_variable_type", + "pylint.extensions.set_membership", + "pylint.extensions.typing", +] + +[tool.pylint.format] +# Maximum number of characters on a single line. +max-line-length = 99 + +[tool.pylint."messages control"] +disable = [ + "fixme", + "no-else-return", + "consider-using-assignment-expr", + "deprecated-typing-alias", # disable for now - only deprecated recently + "docstring-first-line-empty", + "consider-alternative-union-syntax", # disable for now - still supporting python 3.8 + "missing-raises-doc", +] + +[tool.pylint.string] +check-quote-consistency = true +check-str-concat-over-line-jumps = true From 758fbdfd004b1d8c2af56a192788a6f0020712d1 Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Mon, 15 Jul 2024 17:41:12 -0500 Subject: [PATCH 2/2] Pylint fixups (#798) Quiet a handful of messages from a new version of pylint and fix some existing exceptions that got reformatted incorrectly. --------- Co-authored-by: Sergiy Matusevych --- .../mlos_bench/environments/base_environment.py | 4 ++-- .../mlos_bench/environments/composite_env.py | 2 +- .../mlos_bench/environments/local/local_env.py | 2 +- .../environments/local/local_fileshare_env.py | 2 +- mlos_bench/mlos_bench/environments/mock_env.py | 2 +- .../mlos_bench/environments/remote/host_env.py | 2 +- .../mlos_bench/environments/remote/network_env.py | 2 +- .../mlos_bench/environments/remote/os_env.py | 2 +- .../mlos_bench/environments/remote/remote_env.py | 2 +- .../mlos_bench/environments/remote/saas_env.py | 2 +- mlos_bench/mlos_bench/environments/script_env.py | 2 +- mlos_bench/mlos_bench/schedulers/base_scheduler.py | 2 +- .../mlos_bench/services/config_persistence.py | 14 +++++++------- .../services/types/config_loader_type.py | 4 ++-- .../mlos_bench/storage/base_experiment_data.py | 2 +- mlos_bench/mlos_bench/storage/base_storage.py | 6 +++--- mlos_bench/mlos_bench/storage/base_trial_data.py | 2 +- mlos_bench/mlos_bench/storage/sql/experiment.py | 2 +- .../mlos_bench/storage/sql/experiment_data.py | 2 +- mlos_bench/mlos_bench/storage/sql/storage.py | 2 +- mlos_bench/mlos_bench/storage/sql/trial.py | 2 +- mlos_bench/mlos_bench/storage/sql/trial_data.py | 2 +- .../storage/sql/tunable_config_trial_group_data.py | 2 +- mlos_core/mlos_core/optimizers/__init__.py | 2 +- mlos_core/mlos_core/optimizers/optimizer.py | 2 ++ mlos_core/mlos_core/spaces/adapters/llamatune.py | 2 +- .../tests/optimizers/optimizer_multiobj_test.py | 1 + .../mlos_core/tests/optimizers/optimizer_test.py | 1 + mlos_core/mlos_core/tests/spaces/spaces_test.py | 9 ++++++--- 29 files changed, 45 insertions(+), 38 deletions(-) diff --git a/mlos_bench/mlos_bench/environments/base_environment.py b/mlos_bench/mlos_bench/environments/base_environment.py index 2c51a5ee8d..ba346b6765 100644 --- a/mlos_bench/mlos_bench/environments/base_environment.py +++ b/mlos_bench/mlos_bench/environments/base_environment.py @@ -44,7 +44,7 @@ class Environment(metaclass=abc.ABCMeta): """An abstract base of all benchmark environments.""" @classmethod - def new( + def new( # pylint: disable=too-many-arguments cls, *, env_name: str, @@ -94,7 +94,7 @@ def new( service=service, ) - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/composite_env.py b/mlos_bench/mlos_bench/environments/composite_env.py index e37d5273eb..a7edb7bb28 100644 --- a/mlos_bench/mlos_bench/environments/composite_env.py +++ b/mlos_bench/mlos_bench/environments/composite_env.py @@ -23,7 +23,7 @@ class CompositeEnv(Environment): """Composite benchmark environment.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/local/local_env.py b/mlos_bench/mlos_bench/environments/local/local_env.py index c3e81bb94d..989ae96039 100644 --- a/mlos_bench/mlos_bench/environments/local/local_env.py +++ b/mlos_bench/mlos_bench/environments/local/local_env.py @@ -32,7 +32,7 @@ class LocalEnv(ScriptEnv): # pylint: disable=too-many-instance-attributes """Scheduler-side Environment that runs scripts locally.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/local/local_fileshare_env.py b/mlos_bench/mlos_bench/environments/local/local_fileshare_env.py index 14ba59f3f6..351ed9c480 100644 --- a/mlos_bench/mlos_bench/environments/local/local_fileshare_env.py +++ b/mlos_bench/mlos_bench/environments/local/local_fileshare_env.py @@ -27,7 +27,7 @@ class LocalFileShareEnv(LocalEnv): to the shared file storage. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/mock_env.py b/mlos_bench/mlos_bench/environments/mock_env.py index a8888c5e28..765deb05b3 100644 --- a/mlos_bench/mlos_bench/environments/mock_env.py +++ b/mlos_bench/mlos_bench/environments/mock_env.py @@ -25,7 +25,7 @@ class MockEnv(Environment): _NOISE_VAR = 0.2 """Variance of the Gaussian noise added to the benchmark value.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/remote/host_env.py b/mlos_bench/mlos_bench/environments/remote/host_env.py index c6d1c0145e..f33c7b9af8 100644 --- a/mlos_bench/mlos_bench/environments/remote/host_env.py +++ b/mlos_bench/mlos_bench/environments/remote/host_env.py @@ -18,7 +18,7 @@ class HostEnv(Environment): """Remote host environment.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/remote/network_env.py b/mlos_bench/mlos_bench/environments/remote/network_env.py index c87ddd0899..1be78176e9 100644 --- a/mlos_bench/mlos_bench/environments/remote/network_env.py +++ b/mlos_bench/mlos_bench/environments/remote/network_env.py @@ -25,7 +25,7 @@ class NetworkEnv(Environment): but no real tuning is expected for it ... yet. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/remote/os_env.py b/mlos_bench/mlos_bench/environments/remote/os_env.py index 4328b8f694..5bc798244e 100644 --- a/mlos_bench/mlos_bench/environments/remote/os_env.py +++ b/mlos_bench/mlos_bench/environments/remote/os_env.py @@ -20,7 +20,7 @@ class OSEnv(Environment): """OS Level Environment for a host.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/remote/remote_env.py b/mlos_bench/mlos_bench/environments/remote/remote_env.py index c48b84cfdd..1c025a335d 100644 --- a/mlos_bench/mlos_bench/environments/remote/remote_env.py +++ b/mlos_bench/mlos_bench/environments/remote/remote_env.py @@ -32,7 +32,7 @@ class RemoteEnv(ScriptEnv): e.g. Application Environment """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/remote/saas_env.py b/mlos_bench/mlos_bench/environments/remote/saas_env.py index 5d1ba9d800..4b2c772fd6 100644 --- a/mlos_bench/mlos_bench/environments/remote/saas_env.py +++ b/mlos_bench/mlos_bench/environments/remote/saas_env.py @@ -19,7 +19,7 @@ class SaaSEnv(Environment): """Cloud-based (configurable) SaaS environment.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/environments/script_env.py b/mlos_bench/mlos_bench/environments/script_env.py index fe31d6fb13..7938ab65f8 100644 --- a/mlos_bench/mlos_bench/environments/script_env.py +++ b/mlos_bench/mlos_bench/environments/script_env.py @@ -23,7 +23,7 @@ class ScriptEnv(Environment, metaclass=abc.ABCMeta): _RE_INVALID = re.compile(r"[^a-zA-Z0-9_]") - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, name: str, diff --git a/mlos_bench/mlos_bench/schedulers/base_scheduler.py b/mlos_bench/mlos_bench/schedulers/base_scheduler.py index e9c051175a..30b016be74 100644 --- a/mlos_bench/mlos_bench/schedulers/base_scheduler.py +++ b/mlos_bench/mlos_bench/schedulers/base_scheduler.py @@ -27,7 +27,7 @@ class Scheduler(metaclass=ABCMeta): # pylint: disable=too-many-instance-attributes """Base class for the optimization loop scheduling policies.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, config: Dict[str, Any], diff --git a/mlos_bench/mlos_bench/services/config_persistence.py b/mlos_bench/mlos_bench/services/config_persistence.py index 8e8a05b0e8..78c0e1f3ce 100644 --- a/mlos_bench/mlos_bench/services/config_persistence.py +++ b/mlos_bench/mlos_bench/services/config_persistence.py @@ -345,7 +345,7 @@ def build_storage( _LOG.info("Created: Storage %s", inst) return inst - def build_scheduler( + def build_scheduler( # pylint: disable=too-many-arguments self, *, config: Dict[str, Any], @@ -395,8 +395,8 @@ def build_scheduler( _LOG.info("Created: Scheduler %s", inst) return inst - def build_environment( - self, # pylint: disable=too-many-arguments + def build_environment( # pylint: disable=too-many-arguments + self, config: Dict[str, Any], tunables: TunableGroups, global_config: Optional[Dict[str, Any]] = None, @@ -566,8 +566,8 @@ def build_service( return self._build_composite_service(config_list, global_config, parent) - def load_environment( - self, # pylint: disable=too-many-arguments + def load_environment( # pylint: disable=too-many-arguments + self, json_file_name: str, tunables: TunableGroups, global_config: Optional[Dict[str, Any]] = None, @@ -600,8 +600,8 @@ def load_environment( assert isinstance(config, dict) return self.build_environment(config, tunables, global_config, parent_args, service) - def load_environment_list( - self, # pylint: disable=too-many-arguments + def load_environment_list( # pylint: disable=too-many-arguments + self, json_file_name: str, tunables: TunableGroups, global_config: Optional[Dict[str, Any]] = None, diff --git a/mlos_bench/mlos_bench/services/types/config_loader_type.py b/mlos_bench/mlos_bench/services/types/config_loader_type.py index 4eb473edff..b2b6bdf0e5 100644 --- a/mlos_bench/mlos_bench/services/types/config_loader_type.py +++ b/mlos_bench/mlos_bench/services/types/config_loader_type.py @@ -70,8 +70,8 @@ def load_config( Free-format dictionary that contains the configuration. """ - def build_environment( - self, # pylint: disable=too-many-arguments + def build_environment( # pylint: disable=too-many-arguments + self, config: dict, tunables: "TunableGroups", global_config: Optional[dict] = None, diff --git a/mlos_bench/mlos_bench/storage/base_experiment_data.py b/mlos_bench/mlos_bench/storage/base_experiment_data.py index 60c27bc522..a867cd83da 100644 --- a/mlos_bench/mlos_bench/storage/base_experiment_data.py +++ b/mlos_bench/mlos_bench/storage/base_experiment_data.py @@ -30,7 +30,7 @@ class ExperimentData(metaclass=ABCMeta): RESULT_COLUMN_PREFIX = "result." CONFIG_COLUMN_PREFIX = "config." - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, experiment_id: str, diff --git a/mlos_bench/mlos_bench/storage/base_storage.py b/mlos_bench/mlos_bench/storage/base_storage.py index 9c0e88e3d5..c92ede326b 100644 --- a/mlos_bench/mlos_bench/storage/base_storage.py +++ b/mlos_bench/mlos_bench/storage/base_storage.py @@ -72,7 +72,7 @@ def experiments(self) -> Dict[str, ExperimentData]: """ @abstractmethod - def experiment( + def experiment( # pylint: disable=too-many-arguments self, *, experiment_id: str, @@ -118,7 +118,7 @@ class Experiment(metaclass=ABCMeta): This class is instantiated in the `Storage.experiment()` method. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, tunables: TunableGroups, @@ -338,7 +338,7 @@ class Trial(metaclass=ABCMeta): This class is instantiated in the `Storage.Experiment.trial()` method. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, tunables: TunableGroups, diff --git a/mlos_bench/mlos_bench/storage/base_trial_data.py b/mlos_bench/mlos_bench/storage/base_trial_data.py index 2a74d77e5e..4782aa92b3 100644 --- a/mlos_bench/mlos_bench/storage/base_trial_data.py +++ b/mlos_bench/mlos_bench/storage/base_trial_data.py @@ -29,7 +29,7 @@ class TrialData(metaclass=ABCMeta): tunable parameters). """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, experiment_id: str, diff --git a/mlos_bench/mlos_bench/storage/sql/experiment.py b/mlos_bench/mlos_bench/storage/sql/experiment.py index 8f6f938945..5854cba167 100644 --- a/mlos_bench/mlos_bench/storage/sql/experiment.py +++ b/mlos_bench/mlos_bench/storage/sql/experiment.py @@ -25,7 +25,7 @@ class Experiment(Storage.Experiment): """Logic for retrieving and storing the results of a single experiment.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, engine: Engine, diff --git a/mlos_bench/mlos_bench/storage/sql/experiment_data.py b/mlos_bench/mlos_bench/storage/sql/experiment_data.py index f29b9fedda..9103322ae8 100644 --- a/mlos_bench/mlos_bench/storage/sql/experiment_data.py +++ b/mlos_bench/mlos_bench/storage/sql/experiment_data.py @@ -33,7 +33,7 @@ class ExperimentSqlData(ExperimentData): scripts and mlos_bench configuration files. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, engine: Engine, diff --git a/mlos_bench/mlos_bench/storage/sql/storage.py b/mlos_bench/mlos_bench/storage/sql/storage.py index 6b6d11e699..3a272ff19c 100644 --- a/mlos_bench/mlos_bench/storage/sql/storage.py +++ b/mlos_bench/mlos_bench/storage/sql/storage.py @@ -54,7 +54,7 @@ def _schema(self) -> DbSchema: def __repr__(self) -> str: return self._repr - def experiment( + def experiment( # pylint: disable=too-many-arguments self, *, experiment_id: str, diff --git a/mlos_bench/mlos_bench/storage/sql/trial.py b/mlos_bench/mlos_bench/storage/sql/trial.py index 6c2cf26cc7..5942912efd 100644 --- a/mlos_bench/mlos_bench/storage/sql/trial.py +++ b/mlos_bench/mlos_bench/storage/sql/trial.py @@ -23,7 +23,7 @@ class Trial(Storage.Trial): """Store the results of a single run of the experiment in SQL database.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, engine: Engine, diff --git a/mlos_bench/mlos_bench/storage/sql/trial_data.py b/mlos_bench/mlos_bench/storage/sql/trial_data.py index 40362b25fd..ac57b7b5c0 100644 --- a/mlos_bench/mlos_bench/storage/sql/trial_data.py +++ b/mlos_bench/mlos_bench/storage/sql/trial_data.py @@ -25,7 +25,7 @@ class TrialSqlData(TrialData): """An interface to access the trial data stored in the SQL DB.""" - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, engine: Engine, diff --git a/mlos_bench/mlos_bench/storage/sql/tunable_config_trial_group_data.py b/mlos_bench/mlos_bench/storage/sql/tunable_config_trial_group_data.py index 5069e435b2..0e8c022e7f 100644 --- a/mlos_bench/mlos_bench/storage/sql/tunable_config_trial_group_data.py +++ b/mlos_bench/mlos_bench/storage/sql/tunable_config_trial_group_data.py @@ -31,7 +31,7 @@ class TunableConfigTrialGroupSqlData(TunableConfigTrialGroupData): (e.g., for repeats), which we call a (tunable) config trial group. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, engine: Engine, diff --git a/mlos_core/mlos_core/optimizers/__init__.py b/mlos_core/mlos_core/optimizers/__init__.py index 396bd5e212..e9f402c187 100644 --- a/mlos_core/mlos_core/optimizers/__init__.py +++ b/mlos_core/mlos_core/optimizers/__init__.py @@ -58,7 +58,7 @@ class OptimizerFactory: # pylint: disable=too-few-public-methods @staticmethod - def create( + def create( # pylint: disable=too-many-arguments *, parameter_space: ConfigSpace.ConfigurationSpace, optimization_targets: List[str], diff --git a/mlos_core/mlos_core/optimizers/optimizer.py b/mlos_core/mlos_core/optimizers/optimizer.py index 4152e3c4c0..a0026a9155 100644 --- a/mlos_core/mlos_core/optimizers/optimizer.py +++ b/mlos_core/mlos_core/optimizers/optimizer.py @@ -20,6 +20,8 @@ class BaseOptimizer(metaclass=ABCMeta): """Optimizer abstract base class defining the basic interface.""" + # pylint: disable=too-many-instance-attributes + def __init__( self, *, diff --git a/mlos_core/mlos_core/spaces/adapters/llamatune.py b/mlos_core/mlos_core/spaces/adapters/llamatune.py index 38d973a27f..db77483f15 100644 --- a/mlos_core/mlos_core/spaces/adapters/llamatune.py +++ b/mlos_core/mlos_core/spaces/adapters/llamatune.py @@ -35,7 +35,7 @@ class LlamaTuneAdapter(BaseSpaceAdapter): # pylint: disable=too-many-instance-a discretization is used. """ - def __init__( + def __init__( # pylint: disable=too-many-arguments self, *, orig_parameter_space: ConfigSpace.ConfigurationSpace, diff --git a/mlos_core/mlos_core/tests/optimizers/optimizer_multiobj_test.py b/mlos_core/mlos_core/tests/optimizers/optimizer_multiobj_test.py index 748fd1cc82..bd04203b05 100644 --- a/mlos_core/mlos_core/tests/optimizers/optimizer_multiobj_test.py +++ b/mlos_core/mlos_core/tests/optimizers/optimizer_multiobj_test.py @@ -62,6 +62,7 @@ def test_multi_target_opt( """Toy multi-target optimization problem to test the optimizers with mixed numeric types to ensure that original dtypes are retained. """ + # pylint: disable=too-many-locals max_iterations = 10 def objective(point: pd.DataFrame) -> pd.DataFrame: diff --git a/mlos_core/mlos_core/tests/optimizers/optimizer_test.py b/mlos_core/mlos_core/tests/optimizers/optimizer_test.py index a6aa77087c..1ce62d6ee3 100644 --- a/mlos_core/mlos_core/tests/optimizers/optimizer_test.py +++ b/mlos_core/mlos_core/tests/optimizers/optimizer_test.py @@ -376,6 +376,7 @@ def test_mixed_numerics_type_input_space_types( """Toy problem to test the optimizers with mixed numeric types to ensure that original dtypes are retained. """ + # pylint: disable=too-many-locals max_iterations = 10 if kwargs is None: kwargs = {} diff --git a/mlos_core/mlos_core/tests/spaces/spaces_test.py b/mlos_core/mlos_core/tests/spaces/spaces_test.py index 9d4c17f160..49890a7c66 100644 --- a/mlos_core/mlos_core/tests/spaces/spaces_test.py +++ b/mlos_core/mlos_core/tests/spaces/spaces_test.py @@ -125,7 +125,10 @@ def test_continuous_bounds(self) -> None: input_space.add_hyperparameter(CS.UniformIntegerHyperparameter("b", lower=-10, upper=-5)) converted_space = self.conversion_function(input_space) - assert self.get_parameter_names(converted_space) == ["a", "b"] + assert self.get_parameter_names(converted_space) == [ # pylint: disable=unreachable + "a", + "b", + ] point = self.sample(converted_space) assert 100 <= point[0] <= 200 assert -10 <= point[1] <= -5 @@ -136,7 +139,7 @@ def test_uniform_samples(self) -> None: input_space.add_hyperparameter(CS.UniformIntegerHyperparameter("c", lower=1, upper=20)) converted_space = self.conversion_function(input_space) - np.random.seed(42) + np.random.seed(42) # pylint: disable=unreachable uniform, integer_uniform = self.sample(converted_space, n_samples=1000).T # uniform float @@ -152,7 +155,7 @@ def test_uniform_categorical(self) -> None: input_space = CS.ConfigurationSpace() input_space.add_hyperparameter(CS.CategoricalHyperparameter("c", choices=["foo", "bar"])) converted_space = self.conversion_function(input_space) - points = self.sample(converted_space, n_samples=100) + points = self.sample(converted_space, n_samples=100) # pylint: disable=unreachable counts = self.categorical_counts(points) assert 35 < counts[0] < 65 assert 35 < counts[1] < 65