pandera icon indicating copy to clipboard operation
pandera copied to clipboard

feat: add overload.

Open ya7010 opened this issue 1 year ago • 3 comments

Using the latest pylance, pa.Int, etc. will result in an error.

This is because Callable[[_DataTypeClass], _DataTypeClass]] can now be correctly parsed and Callable is now a function and not a class. Defining override avoids problems in many cases, such as pa.Int.

image

English Message is here.

Class is required, but received “_DataTypeClass[Unknown] | ((_DataTypeClass[Unknown]) -> _DataTypeClass[Unknown])”
  “(_DataTypeClass[Unknown]) -> _DataTypeClass[Unknown]” is not a class

Python 3.11.0 pylance v2024.9.2 pandas 2.2.2

ya7010 avatar Sep 30 '24 11:09 ya7010

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.29%. Comparing base (812b2a8) to head (41d5270). Report is 190 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1823      +/-   ##
==========================================
- Coverage   94.28%   93.29%   -1.00%     
==========================================
  Files          91      120      +29     
  Lines        7013     9196    +2183     
==========================================
+ Hits         6612     8579    +1967     
- Misses        401      617     +216     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Sep 30 '24 18:09 codecov[bot]

thanks @yassun7010 ! please be sure to run the pre-commit checks: https://pandera.readthedocs.io/en/latest/CONTRIBUTING.html#set-up-pre-commit

cosmicBboy avatar Sep 30 '24 19:09 cosmicBboy

@cosmicBboy

OK!

pre-commit executed 🙇

ya7010 avatar Oct 01 '24 06:10 ya7010

@yassun7010 looks like linter is still complaining... can you try performing the lint on a python 3.11 environment?

cosmicBboy avatar Nov 01 '24 13:11 cosmicBboy

@cosmicBboy

Thank you!

It appears that pylint does not support overload.

This writing is correct as overload, and the warning was ignored by the comment.

ya7010 avatar Nov 01 '24 14:11 ya7010

@yassun7010 looks like the black linter is unhappy

cosmicBboy avatar Nov 01 '24 14:11 cosmicBboy

@cosmicBboy Sorry 🙏

I fiexed and run pre-commit run --all on Python 3.11.

ya7010 avatar Nov 01 '24 15:11 ya7010

Seems to be a failure in uv installation.

This appears to be a separate issue from this fix.

ya7010 avatar Nov 03 '24 23:11 ya7010

thanks @yassun7010, and congrats on your first contribution to pandera! 🚀

cosmicBboy avatar Nov 13 '24 01:11 cosmicBboy