From cd1c2a981d2956ef29241a95c300ef9ac2a02f8e Mon Sep 17 00:00:00 2001 From: Neil Wu <602725+nwu63@users.noreply.github.com> Date: Tue, 9 May 2023 13:34:39 -0700 Subject: [PATCH] Remove some warnings (#343) * remove unnecessary warning about mpi4py * remove very old deprecation warnings * fix flake8 * really struggling today * version bump --- pyoptsparse/__init__.py | 2 +- pyoptsparse/pyOpt_MPI.py | 12 ++---------- pyoptsparse/pyOpt_optimization.py | 14 -------------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/pyoptsparse/__init__.py b/pyoptsparse/__init__.py index d38556e7..83810ef8 100644 --- a/pyoptsparse/__init__.py +++ b/pyoptsparse/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.9.4" +__version__ = "2.10.0" from .pyOpt_history import History from .pyOpt_variable import Variable diff --git a/pyoptsparse/pyOpt_MPI.py b/pyoptsparse/pyOpt_MPI.py index d97bb008..e1ac263d 100644 --- a/pyoptsparse/pyOpt_MPI.py +++ b/pyoptsparse/pyOpt_MPI.py @@ -8,9 +8,6 @@ # Standard Python modules import os -import warnings - -# isort: off class COMM: @@ -50,6 +47,7 @@ def __init__(self): # and raise exception on failure. If set to anything else, no import is attempted. if "PYOPTSPARSE_REQUIRE_MPI" in os.environ: if os.environ["PYOPTSPARSE_REQUIRE_MPI"].lower() in ["always", "1", "true", "yes"]: + # External modules from mpi4py import MPI else: MPI = myMPI() @@ -57,13 +55,7 @@ def __init__(self): # with a notification. else: try: + # External modules from mpi4py import MPI except ImportError: - warn = ( - "mpi4py could not be imported. mpi4py is required to use " - + "the parallel gradient analysis and parallel objective analysis for " - + "non-gradient based optimizers. Continuing using a dummy MPI module " - + "from pyOptSparse." - ) - warnings.warn(warn, stacklevel=2) MPI = myMPI() diff --git a/pyoptsparse/pyOpt_optimization.py b/pyoptsparse/pyOpt_optimization.py index 607ca4bb..32a55281 100644 --- a/pyoptsparse/pyOpt_optimization.py +++ b/pyoptsparse/pyOpt_optimization.py @@ -4,7 +4,6 @@ import os import pickle from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union -import warnings # External modules import numpy as np @@ -227,11 +226,6 @@ def addVarGroup( f"The 'nVars' argument to addVarGroup must be greater than or equal to 1. The bad DV is {name}." ) - # we let type overwrite the newer varType option name - if "type" in kwargs: - varType = kwargs["type"] - # but we also throw a deprecation warning - warnings.warn("The argument `type=` is deprecated. Use `varType` in the future.", stacklevel=2) # Check that the type is ok if varType not in ["c", "i", "d"]: raise Error("Type must be one of 'c' for continuous, 'i' for integer or 'd' for discrete.") @@ -816,10 +810,6 @@ def finalize(self): self._finalizeConstraints() self.finalized = True - def finalizeDesignVariables(self): - warnings.warn("finalizeDesignVariables() is deprecated, use _finalizeDesignVariables() instead.", stacklevel=2) - self._finalizeDesignVariables() - def _finalizeDesignVariables(self): """ Communicate design variables potentially from different @@ -844,10 +834,6 @@ def _finalizeDesignVariables(self): dvCounter += n self.ndvs = dvCounter - def finalizeConstraints(self): - warnings.warn("finalizeConstraints() is deprecated, use _finalizeConstraints() instead.", stacklevel=2) - self._finalizeConstraints() - def _finalizeConstraints(self): """ There are several functions for this routine: