Skip to content

Commit 5ff3239

Browse files
committed
Fix py3.9 mypy error in __init__ around PackageMetadata
On Python 3.9 ``importlib_metadata`` returns Optional[PackageMetadata] instead of PackageMetadata, this leads to mypy complaining that Optional[...] is not indexable and does not have ``get_all``. Instead, let's just cast it for ourselves.
1 parent 0368a93 commit 5ff3239

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

twine/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import importlib_metadata
4040

4141
metadata = importlib_metadata.metadata("twine")
42+
assert metadata is not None # nosec: B101
4243

4344

4445
__title__ = metadata["name"]

0 commit comments

Comments
 (0)