Skip to content
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

Expand TypeChecker to raise SDCLimitation('...Unsupported...') #771

Open
wants to merge 4 commits into
base: master
from

Conversation

@densmirn
Copy link
Contributor

densmirn commented Mar 25, 2020

No description provided.

@densmirn densmirn requested a review from kozlov-alexey Mar 25, 2020
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):

This comment has been minimized.

@kozlov-alexey

kozlov-alexey Mar 25, 2020

Contributor

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):

This comment has been minimized.

@kozlov-alexey

kozlov-alexey Mar 25, 2020

Contributor

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?

This comment has been minimized.

@densmirn

densmirn Mar 26, 2020

Author Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.