-
Notifications
You must be signed in to change notification settings - Fork 529
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
Type check all exception
arguments in component __call__
implementations
#3538
Conversation
This is great, but should be promulgated to other expression objects:
|
…o numvalue, removing the implementation of __call__ for IndexedParam
… the moment, adding to expr/base.py
…__ implementation
bool
exception
argumentexception
arguments in component __call__
implementations
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3538 +/- ##
=======================================
Coverage 88.70% 88.71%
=======================================
Files 888 888
Lines 101963 102017 +54
=======================================
+ Hits 90445 90502 +57
+ Misses 11518 11515 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@jsiirola this is ready for another review. |
Fixes #2922
Summary/Motivation:
Params and most other numeric- and Boolean-valued components are callable (to get the value), but they did not previously check that the
exception
argument was in fact abool
. This meant it was easy to make a typo missing a*
character and silently rendering part of the expression constant (with the value of a Param, for example). This adds checks in the implementations of__call__
thatexception
is abool
. I still think we should discuss deprecating call to evaluate entirely, but this is a much less invasive change that will raise an error for many typos that would otherwise create silently wrong models.Changes proposed in this PR:
exception
argument in implementations of__call__
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: