Repository navigation
Conversation
|
✅ This PR meets all requirements from our pull request checklist. Optional recommendations:
Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour. |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Contributor
|
@rchen152 has imported this pull request. If you are a Meta employee, you can view this in D129909548. (Because this pull request was imported automatically, there will not be any future comments.) |
rchen152
approved these changes
Nov 7, 2026
stroxler
approved these changes
Nov 7, 2026
stroxler
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Contributor
1 task done
meta-codesync Bot
pushed a commit
that referenced
this pull request
Nov 11, 2026
…efly coverage` (#5613) Summary: Following #5383 and #5552, this relaxes the typable classifier some more for module-level, so that non-generic class constructors now also are counted as implicitly typed, e.g. `BASE_DIR = Path(".")`. - [x] I am a human, and I fully understand the code I am submitting. Pull Request resolved: #5613 Test Plan: there are tests Reviewed By: stroxler Differential Revision: D131224148 fbshipit-source-id: e7fceed6e1aca06f8805bb39cda81288bffa8f5b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I noticed in several projects now that they tend to leave a module-level
logger = logging.getLogger()unannotated in modules without__all__, and don't consider it to be public API. Butpyrefly coverage check, due tologgernot having a leading underscore, will consider it as untyped typable regardless. This is a common enough pattern that I think it's worth special-casinglogging.getLoggerto count it as implicitly typed when unannotated.To confirm my assumptions,I had an agent do a quick code survey (on my local
uv cache), and it found 4,204logging.getLoggercalls of which only 108 were annotated and public.For
re.compileit's very similar, with 137 annotated public module-levelre.compilenames out of 3,902 totalre.compilecalls, so I think that one is also worth special-casing.I had the agent look for other similar module-level constructor calls, but these two were by far the most common.
Test Plan
Integration tests added