-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-125633: Add function ispackage
to stdlib inspect
#125634
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
Conversation
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.
Can you add tests and fix the sphinx markup?
Misc/NEWS.d/next/Library/2024-10-17-04-52-00.gh-issue-125633.lMck06.rst
Outdated
Show resolved
Hide resolved
Please add a unittest and document. Also add to 3.14 what's new(recommend) |
One of the tests is currently failing because you also need to add the new test folder to the Makefile: Line 2500 in 7b04496
should be: test/test_inspect \
+ test/test_inspect/inspect_simple_pkg \ |
ispackage
to stdlib inspect
ispackage
to stdlib inspect
LGTM |
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.
LGTM.
Misc/NEWS.d/next/Library/2024-10-17-04-52-00.gh-issue-125633.lMck06.rst
Outdated
Show resolved
Hide resolved
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.
Thanks!
@brettcannon @ncoghlan: Is it the correct way to check if a module a package, |
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.
Thanks! Several comments :)
I'm not sure Edit: after checking the This also keeps things consistent with the glossary's definition of a package as a module with a |
Thanks for the PR @Xiaokang2022, and thanks for the prior reviews all! |
self.istest(inspect.ispackage, 'importlib') | ||
self.assertFalse(inspect.ispackage(inspect)) | ||
self.assertFalse(inspect.ispackage(mod)) | ||
self.assertFalse(inspect.ispackage(':)')) |
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.
This last test genuinely made me laugh :)
…#125634) --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
ispackage
to stdlibinspect
#125633