Skip to content

Commit

Permalink
Merge pull request #26 from ichrysou/feature/allow_str_formatting_for…
Browse files Browse the repository at this point in the history
…_serialized_version_parts

format version parts
  • Loading branch information
coordt committed Jun 30, 2023
2 parents f4e0334 + ee43bdb commit 978ac7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bumpversion/version_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ def is_independent(self) -> bool:
return self.config.independent

def __format__(self, format_spec: str) -> str:
return self.value
try:
val = int(self.value)
except ValueError:
return self.value
else:
return int.__format__(val, format_spec)

def __repr__(self) -> str:
return f"<bumpversion.VersionPart:{self.func.__class__.__name__}:{self.value}>"
Expand Down

0 comments on commit 978ac7a

Please sign in to comment.