Skip to content

Add Slycot exception and warning classes #117

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 30 commits into from
May 10, 2020

Conversation

bnavigator
Copy link
Collaborator

@bnavigator bnavigator commented May 3, 2020

As proposed in #99, I am introducing the new Exceptions SlycotError, SlycotParameterError and SlycotArithmeticError. So to never forget the .info attribute again!

Fixes #99

@bnavigator bnavigator marked this pull request as ready for review May 4, 2020 16:10
Copy link
Member

@repagh repagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forcing a "None" positional parameter looks a bit ugly to me. For the rest, I like this initiative.

@repagh
Copy link
Member

repagh commented May 5, 2020

Ow. That went quicker than I thought. It seems I was able to push on your branch, if hope you like the modification, if not, ignore/revert.

One of the advantages is that this reduces the number of lines; fewer lines - better coverage.

Look, nice improvement:

coverage/coveralls — Coverage increased (+25.1%) to 68.396%

@bnavigator
Copy link
Collaborator Author

I like it, but right now the raise from docstring always raises SlycotParameterError even when it should be SlycotArithmeticError. Working on this right now

@repagh
Copy link
Member

repagh commented May 5, 2020

I think I accidentally did a wrong force-push, trying to fix the loose ampersand. :-(

@bnavigator
Copy link
Collaborator Author

Yeah, you discarded my edits. No worries, will fix that in my next commit. Probably need to rebase a little bit.

@bnavigator
Copy link
Collaborator Author

Look, nice improvement:

coverage/coveralls — Coverage increased (+25.1%) to 68.396%

It's cheating though because we now parse stuff that is not counted by coverage. ;)

@repagh
Copy link
Member

repagh commented May 6, 2020

Nice work, you lifted it to a whole new level.

Some additional points

  • I see you removed the parsing check from test_sb.py. I worked on an easy routine to verify that a docstring can be parsed for the exceptions that we think are in there. That would offset the "cheating"?
  • I am getting these complaints from git that the recent commit messages have a & and a <, fix or ignore?

@bnavigator
Copy link
Collaborator Author

Yes the original parsing check did not work anymore as the new parser does not return the complete list.

Will fix the commit messages in the next rebase, where I also fix your "merge" commit. Right now I am getting gihub connection errors on git.

I am working on extending this to "Warns" also. There are quite a few routines that use the info parameter for warnings but want to return partial results.

Copy link
Member

@repagh repagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. However, I think we should raise a catch-all exception when we don't find the (non-zero) info value. Otherwise a (future) programming mistake might lead to someone happily accepting erroneous results.

bnavigator added 3 commits May 7, 2020 03:39
- reintroduce catch all
- syntax change: parse variables info and iwarn directly instead of
e.info
- SlycotWarning as also an iwarn attribute
- update all the docstrings of functions that use the Raises and Warns
  sections
- clean functions
- update tests
Copy link
Member

@repagh repagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. I remarked some final issues

@repagh
Copy link
Member

repagh commented May 7, 2020

Looks perfect now. Any objections to a merge?

@bnavigator
Copy link
Collaborator Author

As soon as you said it's perfect, I broke it ;) Fixed now.

With all the numpydoc changes, this is hard to review. Let's give @roryyorke a little bit of time to see if he has any objections.

@bnavigator bnavigator changed the title Add Slycot exception classes Add Slycot exception and warning classes May 7, 2020
@repagh repagh requested a review from roryyorke May 7, 2020 19:24
Copy link
Collaborator

@roryyorke roryyorke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks for all the work.

Besides #99, I image it goes a fair way to addressing #100.

_parse_docsection is a quite complex, but it's an internal tool, so that's fine.

I skimmed over the changes to analysis, synthesis, and math; it generally looks much tidier, and less code is always good.

@bnavigator
Copy link
Collaborator Author

So, time to merge and focus on the release before we get new ideas? ;)

@roryyorke roryyorke merged commit 4ab8e2d into python-control:master May 10, 2020
@bnavigator bnavigator deleted the slycot-error branch December 31, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace ValueError with info attribute with SlycotError
3 participants