Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

densmirn
Copy link
Contributor

No description provided.

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):
Copy link
Contributor

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):
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants