Skip to content

Commit

Permalink
Fixed None as value for a function
Browse files Browse the repository at this point in the history
- Turns None into an empty string
  • Loading branch information
coordt committed Dec 26, 2023
1 parent 5c86d51 commit f8c4d05
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bumpversion/versioning/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ class IndependentFunction(PartFunction):
"""

def __init__(self, value: Union[str, int, None] = None):
if value is None:
value = ""
self.first_value = str(value)
self.optional_value = str(value)
self.independent = True

def bump(self, value: str) -> str:
def bump(self, value: Optional[str] = None) -> str:
"""Return the optional value."""
return self.optional_value
return value or self.optional_value


class NumericFunction(PartFunction):
Expand Down

0 comments on commit f8c4d05

Please sign in to comment.