-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed as not planned
Labels
status: deferredIssue or PR deferred until some precondition is fixedIssue or PR deferred until some precondition is fixed
Description
Since the return value for importlib.metadata.metadata
was fixed in #7331, mypy now incorrectly diagnoses calls to get
as a call to an invalid method. That PR took the approach of importing PackageMetadata
from the relevant module, but that protocol does not apparently capture the entire supported interface.
(Maybe this is a bug in my understanding of the return value of metadata and get
isn't a valid call? But I have a lot of code that does this and it's always worked.)
% cat test.py
from importlib.metadata import metadata
print(metadata("mypy").get("Version"))
% python test.py
0.950
% mypy test.py
test.py:2: error: "PackageMetadata" has no attribute "get"
Found 1 error in 1 file (checked 1 source file)
Metadata
Metadata
Assignees
Labels
status: deferredIssue or PR deferred until some precondition is fixedIssue or PR deferred until some precondition is fixed