Skip to content

functions

Generators for version parts.

Classes

CalVerFunction

CalVerFunction(calver_format: str)

Bases: PartFunction

This is a class that provides a CalVer function for version parts.

Functions

bump
bump(value: Optional[str] = None) -> str

Return the optional value.

IndependentFunction

IndependentFunction(value: Union[str, int, None] = None)

Bases: PartFunction

This is a class that provides an independent function for version parts.

It simply returns the optional value, which is equal to the first value.

Functions

bump
bump(value: Optional[str] = None) -> str

Return the optional value.

NumericFunction

NumericFunction(
    optional_value: Union[str, int, None] = None,
    first_value: Union[str, int, None] = None,
)

Bases: PartFunction

This is a class that provides a numeric function for version parts.

It simply starts with the provided first_value (0 by default) and increases it following the sequence of integer numbers.

The optional value of this function is equal to the first value.

This function also supports alphanumeric parts, altering just the numeric part (e.g. ‘r3’ –> ‘r4’). Only the first numeric group found in the part is considered (e.g. ‘r3-001’ –> ‘r4-001’).

Functions

bump
bump(value: Union[str, int]) -> str

Increase the first numerical value by one.

PartFunction

Base class for a version part function.

Functions

bump
bump(value: str) -> str

Increase the value.

ValuesFunction

ValuesFunction(
    values: List[str],
    optional_value: Optional[str] = None,
    first_value: Optional[str] = None,
)

Bases: PartFunction

This is a class that provides a values list based function for version parts.

It is initialized with a list of values and iterates through them when bumping the part.

The default optional value of this function is equal to the first value, but may be otherwise specified.

When trying to bump a part which has already the maximum value in the list you get a ValueError exception.

Functions

bump
bump(value: str) -> str

Return the item after value in the list.

Functions