python / importlib_metadata

Library to access metadata for Python packages
https://importlib-metadata.readthedocs.io
Apache License 2.0
123 stars 80 forks source link

mypy failing #434

Closed FFY00 closed 1 year ago

FFY00 commented 1 year ago

mypy is failing in the tests with the following error

435: error: Incompatible return value type (got "Message", expected "PackageMetadata")  [return-value]
435: note: Following member(s) of "Message" have conflicts:
435: note:     Expected:
435: note:         def [_T] get_all(self, name: str, failobj: _T = ...) -> Union[List[Any], _T]
435: note:     Got:
435: note:         @overload
435: note:         def get_all(self, name: str, failobj: None = ...) -> Optional[List[Any]]
435: note:         @overload
435: note:         def [_T] get_all(self, name: str, failobj: _T) -> Union[List[Any], _T]

The typeshed definitions changed in https://github.com/python/typeshed/commit/b5a26d1ca258a86a6f133dfabf58790553dc21cf, causing PackageMetadata to fall out of sync. I think the right option here is just to bring PackageMetadata back in sync with email.message.Message