ParsedVersion

class neophile.inventory.version.ParsedVersion

Bases: object

Abstract base class for versions.

We use two separate version implementations, one based on packaging.version.Version and one based on semver.VersionInfo. This class defines the common interface.

Methods Summary

from_str(string)

Parse a string into a version.

is_valid(string)

Return whether a version string is a valid version.

Methods Documentation

abstract classmethod from_str(string: str) → ParsedVersion

Parse a string into a version.

Parameters:

string (str) – The version as a string.

Returns:

version – The parsed version.

Return type:

ParsedVersion

abstract static is_valid(string: str) → bool

Return whether a version string is a valid version.

Parameters:

string (str) – The version as a string.

Returns:

result – Whether it is valid.

Return type:

bool