Skip to content

Commit

Permalink
Remove unnecessary casts (#446)
Browse files Browse the repository at this point in the history
* Remove unnecessary casts

Since incremental has been released, we have type hints for it now.

* Add news fragment
  • Loading branch information
hynek committed Nov 1, 2022
1 parent 45ff8ce commit 827d3b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/towncrier/_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from importlib import import_module
from types import ModuleType
from typing import cast

from incremental import Version

Expand Down Expand Up @@ -52,7 +51,7 @@ def get_version(package_dir: str, package: str) -> str:
return version.strip()

if isinstance(version, Version):
return cast(str, version.base().strip())
return version.base().strip()

if isinstance(version, tuple):
return ".".join(map(str, version)).strip()
Expand All @@ -79,6 +78,6 @@ def get_project_name(package_dir: str, package: str) -> str:

if isinstance(version, Version):
# Incremental has support for package names
return cast(str, version.package)
return version.package

raise TypeError(f"Unsupported type for __version__: {type(version)}")
Empty file.

0 comments on commit 827d3b9

Please sign in to comment.