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

CLN: Type error fix in tests\tseries\offsets\test_yqm_offsets.py #28996

Merged
merged 17 commits into from
Oct 22, 2019

Conversation

lukasbk
Copy link
Contributor

@lukasbk lukasbk commented Oct 15, 2019

The error is due to the fact that the builtins.staticmethod type defined
 in extension.base.base.BaseExtensionTests does not match the function
type in extension.json.test_json.BaseJSON. I don't see a possibility for
a type hint fix without changing the structure of the code. One way
would be to replace the call of staticmethod by function definitions
that call the corresponding methods.
Here I propose an easier suppression of the error using type: Any.
What do you think?
import pandas.util.testing as tm


class BaseExtensionTests:

assert_equal = staticmethod(tm.assert_equal)
assert_series_equal = staticmethod(tm.assert_series_equal)
assert_frame_equal = staticmethod(tm.assert_frame_equal)
assert_series_equal = staticmethod(tm.assert_series_equal) # type: Any
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not clear on why these need to be staticmethods at all

@jreback jreback added the Typing type annotations, mypy/pyright type checking label Oct 15, 2019
Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@lukasbk can you merge master and keep the changes from #28994 and #28990 seperate.

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@lukasbk Thanks for updating the PR. will need to merge master once #29010 merged.

@lukasbk
Copy link
Contributor Author

lukasbk commented Oct 15, 2019

Alright! Sorry for the mess. Still learning how this git really works ;)

@TomAugspurger
Copy link
Contributor

Merging master should fix the CI errors.

@lukasbk
Copy link
Contributor Author

lukasbk commented Oct 20, 2019

Did I do something wrong?

@jbrockmendel
Copy link
Member

Did I do something wrong?

No, the 3.8 build is just flaky. I restarted it, so hopefully this will be green in a bit.

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

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

@simonjayhawkins simonjayhawkins added this to the 1.0 milestone Oct 21, 2019
@WillAyd WillAyd merged commit b1ebae1 into pandas-dev:master Oct 22, 2019
@WillAyd
Copy link
Member

WillAyd commented Oct 22, 2019

Great thanks @lukasbk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants