Skip to content

Commit

Permalink
Remove some warnings (#343)
Browse files Browse the repository at this point in the history
* remove unnecessary warning about mpi4py

* remove very old deprecation warnings

* fix flake8

* really struggling today

* version bump
  • Loading branch information
ewu63 authored May 9, 2023
1 parent 33cca24 commit cd1c2a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pyoptsparse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.9.4"
__version__ = "2.10.0"

from .pyOpt_history import History
from .pyOpt_variable import Variable
Expand Down
12 changes: 2 additions & 10 deletions pyoptsparse/pyOpt_MPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

# Standard Python modules
import os
import warnings

# isort: off


class COMM:
Expand Down Expand Up @@ -50,20 +47,15 @@ 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()
# If PYOPTSPARSE_REQUIRE_MPI is unset, attempt to import mpi4py, but continue on failure
# 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()
14 changes: 0 additions & 14 deletions pyoptsparse/pyOpt_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit cd1c2a9

Please sign in to comment.