GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Switch LTI class and subclasses to use ninputs, noutputs, nstates by murrayrm · Pull Request #515 · python-control/python-control Conversation
|
|
Coverage decreased (-0.06%) to 87.553% when pulling eb401a9 on murrayrm:input_output_to_ninput_noutput into 1502d38 on python-control:master. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Awesome! Looks good to me. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
One more thing I noticed: there are a few mentions of sys.inputs/outputs in docs in xferfunc.py that should probably be fixed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
374c82f to
5a4c3ab
Compare
|
Rebased against master (and apparently fixed up the xferfcn.py docstring, since I can't find sys.inputs in that file anymore). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
May also need to check for self.inputs ?
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
One more comment: was it a deliberate choice to leave init keywords as inputs/outputs rather than ninputs/noutputs, eg in lti.py:
def init(self, inputs=1, outputs=1, dt=None):
Sorry, something went wrong.
There was an error while loading. Please reload this page.
d614c01 to
f633874
Compare
This matches the syntax we use in the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That makes sense. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| raise PendingDeprecationWarning( | ||
| "The LTI `inputs` attribute will be deprecated in a future " | ||
| "release. Use `ninputs` instead.") | ||
| return self.ninputs |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This raises an Exception of the class PendingDeprecationWarning and never returns self.inputs.
Python 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import control
>>> rsys = control.rss(3,3,3)
>>> ninputs = rsys.inputs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ben/src/python-control/control/lti.py", line 64, in inputs
raise PendingDeprecationWarning(
PendingDeprecationWarning: The LTI `inputs` attribute will be deprecated in a future release. Use `ninputs` instead.
>>> ninputs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ninputs' is not defined
| raise PendingDeprecationWarning( | |
| "The LTI `inputs` attribute will be deprecated in a future " | |
| "release. Use `ninputs` instead.") | |
| return self.ninputs | |
| warn("The LTI `inputs` attribute will be deprecated in a future " | |
| "release. Use `ninputs` instead.", | |
| PendingDeprecationWarning, stacklevel=2) | |
| return self.ninputs |
Additionally, either a warning filter needs to be set in order to make the warning visible to end users, or a different category than *DeprecationWarning needs to be used.
filterwarnings('module', message=".*LTI.*attribute.*deprecated", category=PendingDeprecationWarning)
Python 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import control; rsys = control.rss(3,3,3); ninputs = rsys.inputs
<stdin>:1: PendingDeprecationWarning: The LTI `inputs` attribute will be deprecated in a future release. Use `ninputs` instead.
>>> ninputs
3
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I've fixed these up and decide to use DeprecationWarning for now (keep things internal to developers) but in a future release (0.9.x) we should change to FutureWarning, which will make it show up for users as well.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Still using raise instead of warn. Now we are at:
This raises an Exception of the class
DeprecationWarningand never returns self.inputs.
Python 3.8.6 (default, Nov 09 2020, 12:09:06) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import control; rsys = control.rss(3,3,3); ninputs = rsys.inputs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ben/src/python-control/control/lti.py", line 64, in inputs
raise DeprecationWarning(
DeprecationWarning: The LTI `inputs` attribute will be deprecated in a future release. Use `ninputs` instead.
>>> ninputs
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ninputs' is not defined
>>>
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| with pytest.raises(DeprecationWarning, match="LTI `inputs`"): | ||
| assert sys.inputs == sys.ninputs |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The assert .. == part is never evaluated after sys.ninputs throws the exception.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, was working on multiple changes/branches at once and pushed the wrong version. New one was what was intended.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
bed8990 to
ff5fb39
Compare
ff5fb39 to
eb401a9
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.