-
Notifications
You must be signed in to change notification settings - Fork 61
Expand TypeChecker to raise SDCLimitation('...Unsupported...') #771
base: master
Are you sure you want to change the base?
Conversation
sdc/utilities/sdc_typing_utils.py
Outdated
self._raise_exc(self, exc_cls, self.default_tmpl, self.func_name, | ||
name, data, expected_types) | ||
|
||
def raise_unsupported_exc(self, data, name='', exc_cls=TypingError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use default exception as SDCLimitation, as it seems to be more appropriate in this case?
self._raise_exc(exc_cls, self.default_tmpl, self.func_name, | ||
name, data, expected_types) | ||
|
||
def raise_unsupported_exc(self, data, name='', exc_cls=SDCLimitation): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of replacing all raises related to SDC limitations with this, but it seems this only covers case of unsupported parameters, so for instance in series.fillna we have:
raise TypingError('{} Not implemented when Series dtype is {} and\
inplace={}'.format(_func_name, self.dtype, inplace))
Maybe add in raise_exc and internal func additional parameter e.g. msg, which if exists will be used instead of default msg format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to replace call
msg = '{} Not implemented when Series dtype is {} and inplace={}'.format(_func_name, self.dtype, inplace)
raise SDCLimitation(msg)
with something like this
msg = '{} Not implemented when Series dtype is {} and inplace={}'.format(_func_name, self.dtype, inplace)
ty_checker.raise_exc(None, None, exc_cls=SDCLimitation, msg=msg)
?
I think TypeChecker
shouldn't be used for such complicated cases, TypeChecker
doesn't make sense, when it increases the amount of code and makes it harder.
Maybe I didn't catch you correctly, please correct me in this case.
No description provided.