You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3a261cc
Browse filesBrowse the repository at this point in the historyBrowse files
Special-case logging.Logger and re.Pattern in pyrefly coverage (#5552)
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. But `pyrefly coverage check`, due to `logger` not having a leading underscore, will consider it as untyped typable regardless. This is a common enough pattern that I think it's worth special-casing `logging.getLogger` to 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,204 `logging.getLogger` calls of which only 108 were annotated and public.
For `re.compile` it's very similar, with 137 annotated public module-level `re.compile` names out of 3,902 total `re.compile` calls, 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.
- [x] I am a human, and I fully understand the code I am submitting.
Pull Request resolved: #5552
Test Plan: Integration tests added
Reviewed By: stroxler
Differential Revision: D129909548
Pulled By: rchen152
fbshipit-source-id: 7aec2051bd093ed9e3b278b079a0b3cf58bd8ff6
0 commit comments