8000 Merge pull request #795 from roryyorke/rory/pylint-fixes · python-control/python-control@2746ce1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2746ce1

Browse files
authored
Merge pull request #795 from roryyorke/rory/pylint-fixes
Fixes for bugs found by pylint
2 parents 2a799e9 + f591c08 commit 2746ce1

File tree

5 files changed

+6
-15
lines changed

5 files changed

+6
-15
lines changed

control/iosys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ def _rhs(self, t, x, u):
366366
you may want to use :meth:`dynamics`.
367367
368368
"""
369-
NotImplemented("Evaluation not implemented for system of type ",
370-
type(self))
369+
raise NotImplementedError("Evaluation not implemented for system of type ",
370+
type(self))
371371

372372
def dynamics(self, t, x, u, params=None):
373373
"""Compute the dynamics of a differential or difference equation.

control/modelsimp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def markov(Y, U, m=None, transpose=False):
476476

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

481481
#
482482
# Original algorithm (with mapping to standard order)

control/optimal.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
from .exception import ControlNotImplemented
2121
from .timeresp import TimeResponseData
2222

23-
__all__ = ['find_optimal_input']
24-
2523
# Define module default parameter values
2624
_optimal_defaults = {
2725
'optimal.minimize_method': None,

control/statesp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
from scipy.signal import cont2discrete
6060
from scipy.signal import StateSpace as signalStateSpace
6161
from warnings import warn
62+
63+
from .exception import ControlSlycot
6264
from .frdata import FrequencyResponseData
6365
from .lti import LTI, _process_frequency_response
6466
from .namedio import common_timebase, isdtime

control/tests/optimal_test.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -381,17 +381,8 @@ def test_optimal_logging(capsys):
381381
@pytest.mark.parametrize("fun, args, exception, match", [
382382
[opt.quadratic_cost, (np.zeros((2, 3)), np.eye(2)), ValueError,
383383
"Q matrix is the wrong shape"],
384-
[opt.quadratic_cost, (np.eye(2), 1), ValueError,
384+
[opt.quadratic_cost, (np.eye(2), np.eye(2, 3)), ValueError,
385385
"R matrix is the wrong shape"],
386-
])
387-
def test_constraint_constructor_errors(fun, args, exception, match):
388-
"""Test various error conditions for constraint constructors"""
389-
sys = ct.ss2io(ct.rss(2, 2, 2))
390-
with pytest.raises(exception, match=match):
391-
fun(sys, *args)
392-
393-
394-
@pytest.mark.parametrize("fun, args, exception, match", [
395386
[opt.input_poly_constraint, (np.zeros((2, 3)), [0, 0]), ValueError,
396387
"polytope matrix must match number of inputs"],
397388
[opt.output_poly_constraint, (np.zeros((2, 3)), [0, 0]), ValueError,

0 commit comments

Comments
 (0)
0