-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CI: linting check to ensure lib.NoDefault
is only used for typing
#53901
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
CI: linting check to ensure lib.NoDefault
is only used for typing
#53901
Conversation
nice idea I think you're repeatedly walking up and down the same paths - do you want to check |
Improved from approx. 10s for all files to approx. 4s @MarcoGorelli Thanks for your suggestion! |
Well done! Would appreciate it if we could add a tiny little test case to scripts/tests/test_validate_unwanted_patterns.py too Other than that, looks good! |
Didn't notice that there are tests for linting scripts, thanks for the reminder @MarcoGorelli. Added some simple tests now. |
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.
Nice thanks @Charlie-XIAO |
…andas-dev#53901) * CI add liniting to check NoDefault used only for typing * minor modification * reduce cost * tests added for the new linting check * types_or -> types because only python * rephrase pre-commit hook name * rephrase more * fix failing tests: * retrigger checks * retrigger checks
lib.no_default
instead oflib.NoDefault
in.pivot
#53877 (comment)In this PR, I added a pre-commit hook to check that
pandas._libs.lib.NoDefault
is used only for typing. This is invoked by #53877. Before that PR, this new hook correctly catches all misusedNoDefault
:After that PR, the check passes normally:
In fact I don't work with ASTs very often so not sure if this check covers all possibilties. Please let me know if any modification is needed. (The runtime is a bit long but seems acceptable, approximately 10s to check all files.)