Skip to content

Specification

Specification

Bases: Protocol

The specification protocol for defining version requirements.

Source code in versions/specification.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@runtime_checkable
class Specification(Protocol):
    """The specification protocol for defining version requirements."""

    @required
    def accepts(self, version: Version) -> bool:
        """Checks if the `version` matches the specification.

        Arguments:
            version: The version to check.

        Returns:
            Whether the `version` matches the specification.
        """
        raise NotImplementedError(expected_method(ACCEPTS))

accepts(version: Version) -> bool

Checks if the version matches the specification.

Parameters:

Name Type Description Default
version Version

The version to check.

required

Returns:

Type Description
bool

Whether the version matches the specification.

Source code in versions/specification.py
23
24
25
26
27
28
29
30
31
32
33
@required
def accepts(self, version: Version) -> bool:
    """Checks if the `version` matches the specification.

    Arguments:
        version: The version to check.

    Returns:
        Whether the `version` matches the specification.
    """
    raise NotImplementedError(expected_method(ACCEPTS))