Skip to content

Fixes for bugs found by pylint #795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions control/iosys.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ def _rhs(self, t, x, u):
you may want to use :meth:`dynamics`.

"""
NotImplemented("Evaluation not implemented for system of type ",
type(self))
raise NotImplementedError("Evaluation not implemented for system of type ",
type(self))

def dynamics(self, t, x, u, params=None):
"""Compute the dynamics of a differential or difference equation.
Expand Down
2 changes: 1 addition & 1 deletion control/modelsimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def markov(Y, U, m=None, transpose=False):

# Make sure there is enough data to compute parameters
if m > n:
warn.warning("Not enough data for requested number of parameters")
warnings.warn("Not enough data for requested number of parameters")

#
# Original algorithm (with mapping to standard order)
Expand Down
2 changes: 0 additions & 2 deletions control/optimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
from .exception import ControlNotImplemented
from .timeresp import TimeResponseData

__all__ = ['find_optimal_input']

# Define module default parameter values
_optimal_defaults = {
'optimal.minimize_method': None,
Expand Down
2 changes: 2 additions & 0 deletions control/statesp.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
from scipy.signal import cont2discrete
from scipy.signal import StateSpace as signalStateSpace
from warnings import warn

from .exception import ControlSlycot
from .frdata import FrequencyResponseData
from .lti import LTI, _process_frequency_response
from .namedio import common_timebase, isdtime
Expand Down
11 changes: 1 addition & 10 deletions control/tests/optimal_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,8 @@ def test_optimal_logging(capsys):
@pytest.mark.parametrize("fun, args, exception, match", [
[opt.quadratic_cost, (np.zeros((2, 3)), np.eye(2)), ValueError,
"Q matrix is the wrong shape"],
[opt.quadratic_cost, (np.eye(2), 1), ValueError,
[opt.quadratic_cost, (np.eye(2), np.eye(2, 3)), ValueError,
"R matrix is the wrong shape"],
])
def test_constraint_constructor_errors(fun, args, exception, match):
"""Test various error conditions for constraint constructors"""
sys = ct.ss2io(ct.rss(2, 2, 2))
with pytest.raises(exception, match=match):
fun(sys, *args)


@pytest.mark.parametrize("fun, args, exception, match", [
[opt.input_poly_constraint, (np.zeros((2, 3)), [0, 0]), ValueError,
"polytope matrix must match number of inputs"],
[opt.output_poly_constraint, (np.zeros((2, 3)), [0, 0]), ValueError,
Expand Down