Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary casts #446

Merged
merged 2 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.