Skip to content

Commit

Permalink
Silence mypy errors related to importlib_metadata (#988)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrutledge committed Apr 27, 2023
1 parent 9c2c0a1 commit 7c8d616
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions twine/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def list_dependencies_and_versions() -> List[Tuple[str, str]]:
"requests-toolbelt",
"urllib3",
)
return [(dep, importlib_metadata.version(dep)) for dep in deps] # type: ignore[no-untyped-call] # python/importlib_metadata#288 # noqa: E501
return [(dep, importlib_metadata.version(dep)) for dep in deps]


def dep_versions() -> str:
Expand Down Expand Up @@ -118,6 +118,6 @@ def dispatch(argv: List[str]) -> Any:

configure_output()

main = registered_commands[args.command].load()
main = registered_commands[args.command].load() # type: ignore[no-untyped-call] # python/importlib_metadata#288 # noqa: E501

return main(args.args)
4 changes: 1 addition & 3 deletions twine/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ def from_filename(cls, filename: str, comment: Optional[str]) -> "PackageFile":

py_version: Optional[str]
if dtype == "bdist_egg":
(dist,) = importlib_metadata.Distribution.discover( # type: ignore[no-untyped-call] # python/importlib_metadata#288 # noqa: E501
path=[filename]
)
(dist,) = importlib_metadata.Distribution.discover(path=[filename])
py_version = dist.metadata["Version"]
elif dtype == "bdist_wheel":
py_version = cast(wheel.Wheel, meta).py_version
Expand Down

0 comments on commit 7c8d616

Please sign in to comment.